camerauis/cameraapp/generic/src/CamImageSaveActive.cpp
changeset 0 1ddebce53859
child 7 dbec5787fa68
equal deleted inserted replaced
-1:000000000000 0:1ddebce53859
       
     1 /*
       
     2 * Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Active object that manages saving and deletion of images*
       
    15 */
       
    16 
       
    17 
       
    18 
       
    19 // INCLUDE FILES
       
    20 #include <badesca.h>
       
    21 #include <eikenv.h>
       
    22 #include <sysutil.h>
       
    23 #include <AknProgressDialog.h>
       
    24 #include <eikprogi.h>
       
    25 #include <StringLoader.h>
       
    26 #include <AknQueryDialog.h>
       
    27 #include <pathinfo.h>
       
    28 
       
    29 // includes to allow reporting to LifeBlog via publish and subscribe API
       
    30 #include <e32property.h>
       
    31 
       
    32 #include <cameraapp.rsg>
       
    33 #include <vgacamsettings.rsg>
       
    34 
       
    35 #include "CamImageSaveActive.h"
       
    36 #include "CamPanic.h"
       
    37 #include "CamUtility.h"
       
    38 #include "CamPerformance.h"
       
    39 #include "cambuffershare.h"
       
    40 #include "OstTraceDefinitions.h"
       
    41 #ifdef OST_TRACE_COMPILER_IN_USE
       
    42 #include "CamImageSaveActiveTraces.h"
       
    43 #endif
       
    44 #include "camuidconstants.h" // KPSUidCamcorderNotifier
       
    45 
       
    46 #include "CameraappPrivateCRKeys.h"
       
    47 
       
    48 #include "CamAppController.h"
       
    49 #include "CameraUiConfigManager.h"
       
    50 #include "CamBurstCaptureArray.h"
       
    51 
       
    52 const TUint32 KCamLatestFilePath      = 0x00000001;
       
    53 const TInt    KArrayGranularity       = 2;
       
    54 const TInt    KCapturedAlbumId        = 2; 
       
    55 
       
    56 // CONSTANTS
       
    57 
       
    58 // ============================ MEMBER FUNCTIONS ===============================
       
    59 
       
    60 // -----------------------------------------------------------------------------
       
    61 // CCamImageSaveActive::NewL
       
    62 // Two-phased constructor.
       
    63 // -----------------------------------------------------------------------------
       
    64 //
       
    65 CCamImageSaveActive* CCamImageSaveActive::NewL( MCamImageSaveObserver& aObserver,  
       
    66                                                 CCamAppController&  aController )
       
    67     {
       
    68     PRINT( _L("Camera => CCamImageSaveActive::NewL") );
       
    69 
       
    70     CCamImageSaveActive* self = new( ELeave ) CCamImageSaveActive( aObserver, 
       
    71                                                                    aController );
       
    72     CleanupStack::PushL( self );
       
    73     self->ConstructL();
       
    74     CleanupStack::Pop( self );
       
    75 
       
    76     PRINT( _L("Camera <= CCamImageSaveActive::NewL") );
       
    77     return self;
       
    78     }
       
    79 
       
    80     
       
    81 // -----------------------------------------------------------------------------
       
    82 // CCamImageSaveActive::~CCamImageSaveActive
       
    83 // Destructor
       
    84 // -----------------------------------------------------------------------------
       
    85 //
       
    86 CCamImageSaveActive::~CCamImageSaveActive()
       
    87     {
       
    88     PRINT( _L("Camera => ~CCamImageSaveActive") );
       
    89     delete iSaveArray;
       
    90 
       
    91     delete iNameArray;
       
    92     iSnapArray.ResetAndDestroy();
       
    93     delete iManager;
       
    94             
       
    95     ReleaseAllAndDestroy( iImageArray );
       
    96     iImageArray.Close();
       
    97 
       
    98     iThumbnailRequests.Close();
       
    99     DoDismissProgressNote();
       
   100 
       
   101 #if defined(RD_MDS_2_5) && !defined(__WINSCW__) && !defined(__WINS__)
       
   102     DeRegisterHarverterClientEvents();
       
   103     iHarvesterClient.Close();
       
   104 #endif // defined(RD_MDS_2_5) && !defined(__WINSCW__) && !defined(__WINS__)
       
   105 
       
   106     PRINT( _L("Camera <= ~CCamImageSaveActive") );
       
   107     }
       
   108 
       
   109 // -----------------------------------------------------------------------------
       
   110 // CCamImageSaveActive::Cancel
       
   111 // Cancel any current or pending actions
       
   112 // -----------------------------------------------------------------------------
       
   113 //
       
   114 void CCamImageSaveActive::Cancel()
       
   115     {
       
   116     PRINT( _L( "Camera => CCamImageSaveActive::Cancel" ) );
       
   117  
       
   118     TBool storageOk( ETrue );
       
   119     if ( iController.SequenceCaptureInProgress() )
       
   120         {
       
   121         TCamMediaStorage storageLocation = static_cast<TCamMediaStorage> ( 
       
   122                 iController.IntegerSettingValueUnfiltered(  
       
   123                         ECamSettingItemPhotoMediaStorage ) );
       
   124         if ( storageLocation == ECamMediaStorageCard )
       
   125             {
       
   126             // Avoid deleting and saving to drive which does not exist
       
   127             storageOk = CamUtility::MemoryCardStatus() == ECamMemoryCardInserted;
       
   128             PRINT1( _L( "Camera => CCamImageSaveActive::Cancel storageOk=%d" ), storageOk);
       
   129             }
       
   130         }
       
   131 
       
   132     // Since this function may be called in the destructor, we need to check
       
   133     // that iSaveArray is not null. 
       
   134     if(iSaveArray)
       
   135         {
       
   136         TInt count = iSaveArray->Count() - 1;
       
   137         TInt lowest = 0;
       
   138         if ( iSaveCurrent )
       
   139             {
       
   140             lowest = 1;
       
   141             }
       
   142         TInt i;
       
   143 
       
   144         // Delete all dummy files except any currently saving one
       
   145         for ( i = count; i >= lowest; i-- )
       
   146             {
       
   147             PRINT1( _L( "Camera Deleting file index %d" ), i );         
       
   148             if( storageOk )
       
   149                 {
       
   150                 DeleteFile( iSaveArray->MdcaPoint( i ), ETrue );  
       
   151                 }
       
   152             }
       
   153         }
       
   154     // if a file is currently saving, delay cleanup till save completes
       
   155     // if ( iSaveCurrent )
       
   156     if ( IsActive() && storageOk )
       
   157         {
       
   158         PRINT( _L( "Camera File currently saving delay cleanup" ) );         
       
   159         iDoCancel = ETrue;
       
   160         if ( !iWait.IsStarted() )
       
   161           {
       
   162           iWait.Start();
       
   163           }
       
   164         }
       
   165     // otherwise, complete cleanup now
       
   166     else
       
   167         {
       
   168         PRINT( _L( "Camera No file saving cleanup now" ) );         
       
   169         DoDismissProgressNote();
       
   170         CActive::Cancel();
       
   171         if(iSaveArray)
       
   172             {
       
   173             iSaveArray->Reset();
       
   174             }
       
   175         ReleaseAllAndDestroy( iImageArray );
       
   176         }
       
   177     PRINT( _L( "Camera <= CCamImageSaveActive::Cancel" ) );         
       
   178     }
       
   179 
       
   180 void CCamImageSaveActive::ForceCancel()
       
   181 {
       
   182     CActive::Cancel();
       
   183 }
       
   184 // -----------------------------------------------------------------------------
       
   185 // CCamImageSaveActive::AddToSave
       
   186 // Add an image to the list of required saves, activate if needed
       
   187 // -----------------------------------------------------------------------------
       
   188 //
       
   189 TBool CCamImageSaveActive::AddToSave( const TDesC&     aFilename, 
       
   190                                       CCamBufferShare* aImageData )
       
   191     {
       
   192     PRINT( _L("Camera => CCamImageSaveActive::AddToSave") );
       
   193     if( aImageData )
       
   194       {
       
   195       aImageData->Reserve();
       
   196       }
       
   197 
       
   198     // Keep note of how many items exist before we try to add a new one
       
   199     TInt count = iSaveArray->Count();
       
   200     TRAPD( err, iSaveArray->AppendL( aFilename ) );
       
   201     if ( !err )
       
   202         {
       
   203         TRAP( err, iImageArray.AppendL( aImageData ) );
       
   204         }
       
   205     // if any of the appends failed then clean out the partial item
       
   206     if ( err )
       
   207         {
       
   208         if ( iSaveArray->Count() > count )
       
   209             {
       
   210             iSaveArray->Delete( count );
       
   211             }
       
   212         if ( iImageArray.Count() > count )
       
   213             {
       
   214             iImageArray.Remove( count );
       
   215             if( aImageData )
       
   216               {
       
   217               aImageData->Release();
       
   218               }
       
   219             }
       
   220         PRINT( _L("Camera <= CCamImageSaveActive::AddToSave, error!") );
       
   221         return EFalse;
       
   222         }
       
   223     // the item is successfully added, start the save now if not currently saving
       
   224     if ( !IsActive() )
       
   225         {
       
   226         SetActiveAndCompleteRequest();
       
   227         }
       
   228 
       
   229     PRINT( _L("Camera <= CCamImageSaveActive::AddToSave, ok") );
       
   230     return ETrue;
       
   231     }
       
   232  
       
   233  
       
   234 // -----------------------------------------------------------------------------
       
   235 // CCamImageSaveActive::FileSize
       
   236 // Returns the size of the data for the specified file
       
   237 // -----------------------------------------------------------------------------
       
   238 //    
       
   239 TInt CCamImageSaveActive::FileSize( const TDesC& aFilename ) const
       
   240     {    
       
   241     TInt size = KErrNotFound;
       
   242     TInt count = iSaveArray->Count();
       
   243     TInt i;
       
   244     
       
   245     // Check to see if it is in the "to be saved" array
       
   246     for ( i = 0; i < count ; i++ )
       
   247         {
       
   248         TPtrC ptr = (*iSaveArray)[i];
       
   249         if ( aFilename.Compare( ptr ) == 0 )    
       
   250             {
       
   251             TRAP_IGNORE( size = iImageArray[i]->SharedBuffer()->DataL( 0 )->Size() );
       
   252             // size = iImageArray[i]->Size();
       
   253             return size;
       
   254             }
       
   255         }   
       
   256         
       
   257     // If we have got here, the requested file is NOT in the array
       
   258     // Check the file system to see if we have already saved it.
       
   259     RFs& fs = CEikonEnv::Static()->FsSession();
       
   260     RFile file;
       
   261     TInt ret = file.Open( fs, aFilename, EFileShareAny | EFileRead );    
       
   262     if ( ret == KErrNone )
       
   263         {
       
   264         file.Size( size );                
       
   265         }
       
   266     file.Close();        
       
   267     return size;
       
   268     }
       
   269     
       
   270     
       
   271     
       
   272 // -----------------------------------------------------------------------------
       
   273 // CCamImageSaveActive::DeleteFile
       
   274 // Delete a file, cancelling any pending save
       
   275 // -----------------------------------------------------------------------------
       
   276 //
       
   277 TInt CCamImageSaveActive::DeleteFile( const TDesC& aFilename, 
       
   278                                       TBool aSaveRequested )
       
   279     {
       
   280     RFs& fs = CEikonEnv::Static()->FsSession();
       
   281     if ( aSaveRequested )
       
   282         {
       
   283         TInt index;
       
   284         if ( iSaveArray->Find( aFilename, index ) == 0 )
       
   285             {
       
   286             // if the file is currently being saved
       
   287             if ( index == 0 && iSaveCurrent )
       
   288                 {
       
   289                 iDeleteCurrent = ETrue;
       
   290                 return ETrue;
       
   291                 }
       
   292             else
       
   293                 {
       
   294                 iSaveArray->Delete( index );
       
   295                 iSaveArray->Compress();
       
   296 
       
   297                 CCamBufferShare* item = iImageArray[index];
       
   298                 iImageArray.Remove( index );
       
   299                 if( item )
       
   300                   {
       
   301                   item->Release();
       
   302                   item = NULL;
       
   303                   }
       
   304 
       
   305                 iImageArray.Compress();
       
   306                 }
       
   307             } 
       
   308         }
       
   309 
       
   310     // Dummy files are read only for protection, make sure the file is writable
       
   311     fs.SetAtt( aFilename, 0, KEntryAttReadOnly );
       
   312     TInt ret = fs.Delete( aFilename );  
       
   313     ReportToObserver( ECamSaveEventDeleted );
       
   314 
       
   315     return ret;
       
   316     }
       
   317 
       
   318 // ---------------------------------------------------------------------------
       
   319 // CCamImageSaveActive::AlreadySavedFile
       
   320 // Returns whether a particular file has already been saved.
       
   321 // ---------------------------------------------------------------------------
       
   322 //
       
   323 TBool CCamImageSaveActive::AlreadySavedFile( const TDesC& aFilename ) const
       
   324     {
       
   325     TInt index;
       
   326     return iSaveArray->Find( aFilename, index );
       
   327     }
       
   328 
       
   329 // ---------------------------------------------------------------------------
       
   330 // CCamImageSaveActive::CurrentlySavingFile
       
   331 // Returns whether a particular file is in the process of being saved.
       
   332 // ---------------------------------------------------------------------------
       
   333 //
       
   334 TBool CCamImageSaveActive::CurrentlySavingFile( const TDesC& aFilename ) const
       
   335     {
       
   336     TInt index;
       
   337     if ( iSaveCurrent && ( iSaveArray->Find( aFilename, index ) == 0 ) &&
       
   338         ( index == 0 ) )
       
   339         {
       
   340         return ETrue;
       
   341         }
       
   342     return EFalse;
       
   343     }
       
   344 
       
   345 // -----------------------------------------------------------------------------
       
   346 // CCamImageSaveActive::DisplayProgressNote
       
   347 // Display the saving progress note until cancelled or completed
       
   348 // -----------------------------------------------------------------------------
       
   349 //
       
   350 void CCamImageSaveActive::DisplayProgressNote( TInt aExpectedImages )
       
   351     {
       
   352     __ASSERT_DEBUG( !iDismissNote, CamPanic( ECamPanicInvalidState ) );
       
   353     // Initialise for a new burst set
       
   354     iSaveProgressCount = 0;
       
   355     iExpectedImages = aExpectedImages;
       
   356     iShowNote = ETrue;
       
   357     if ( !IsActive() )
       
   358         {
       
   359         SetActiveAndCompleteRequest();
       
   360         }
       
   361     }
       
   362 
       
   363 // -----------------------------------------------------------------------------
       
   364 // CCamImageSaveActive::DismissProgressNote
       
   365 // Dismiss the saving progress note when completed
       
   366 // -----------------------------------------------------------------------------
       
   367 //
       
   368 void CCamImageSaveActive::DismissProgressNote()
       
   369     {
       
   370     // if the progress note is still pending
       
   371     if ( iShowNote )
       
   372         {
       
   373         // the burst has completed already
       
   374         iShowNote = EFalse;
       
   375         ReportToObserver( ECamSaveEventBurstComplete );
       
   376         }
       
   377 
       
   378     // No saves are pending, dismiss the note now
       
   379     if ( !IsActive() )
       
   380         {
       
   381         DoDismissProgressNote();
       
   382         }
       
   383     else // otherwise, wait till all the saves complete
       
   384         {
       
   385         iDismissNote = ETrue;
       
   386         }
       
   387     }
       
   388 
       
   389 // -----------------------------------------------------------------------------
       
   390 // CCamImageSaveActive::SetAddImageToAlbum
       
   391 // Set the "Add to album" feature on or off for photos
       
   392 // -----------------------------------------------------------------------------
       
   393 //
       
   394 void CCamImageSaveActive::SetAddImageToAlbum( const TBool aAdding, 
       
   395                                               const TUint32 aDefaultAlbumId )
       
   396     {
       
   397     iAddImageToAlbum = aAdding;
       
   398     iDefaultAlbumId = aDefaultAlbumId;
       
   399     }
       
   400 
       
   401 // -----------------------------------------------------------------------------
       
   402 // CCamImageSaveActive::AddToAlbum
       
   403 // Add the specified photo or video to the default capture album
       
   404 // -----------------------------------------------------------------------------
       
   405 //
       
   406 #if defined(RD_MDS_2_5) && !defined(__WINSCW__) && !defined(__WINS__)
       
   407 void CCamImageSaveActive::AddToAlbum( const TDesC& aFilename,
       
   408                                       const TBool aAddToAlbum,
       
   409                                       const TUint32 aDefaultAlbumId )
       
   410     {
       
   411     OstTrace0( CAMERAAPP_PERFORMANCE_DETAIL, CCAMIMAGESAVEACTIVE_ADDTOALBUM, "e_CCamImageSaveActive_AddToAlbum 1" );
       
   412     PRINT( _L("Camera => CCamImageSaveActive::AddToAlbum") );
       
   413 
       
   414     TInt err = KErrNone;
       
   415     RArray<TUint32> harvestAlbumIds;
       
   416     TUint32 harvestAlbumId;
       
   417     err = harvestAlbumIds.Append( KCapturedAlbumId ); 
       
   418 
       
   419     /*
       
   420     * NOTE: The default value of album Id defined as per CenRep key is 0, so 
       
   421     *       we add the any other album other than the default one as above
       
   422     *       Secondly, if there is no album set as default album from the 
       
   423     *       precapture settings views then we pass empty array to the harvester
       
   424     *       and MDS harvests the file to camera album directly i.e. captured.
       
   425     */
       
   426 
       
   427     if ( aAddToAlbum && aDefaultAlbumId > 0 )
       
   428        {
       
   429        harvestAlbumId = aDefaultAlbumId;
       
   430        err = harvestAlbumIds.Append( harvestAlbumId );
       
   431        }
       
   432     
       
   433     if ( !iHarvesterClientConnected )
       
   434         {
       
   435         PRINT( _L("Camera <> calling iHarvesterClient.Connect") );
       
   436         err = iHarvesterClient.Connect();
       
   437         if ( !err )
       
   438             {
       
   439             iHarvesterClientConnected = ETrue;
       
   440             }
       
   441         PRINT1( _L("Camera <> iHarvesterClient.Connect returned %d"), err );
       
   442         }
       
   443     
       
   444     if ( KErrNone == err )
       
   445         {
       
   446         RegisterForHarvesterEvents();
       
   447 
       
   448         PRINT( _L("Camera <> calling iHarvesterClient.HarvestFile") );
       
   449 
       
   450 #ifdef RD_MDS_2_5   
       
   451         if ( iController.UiConfigManagerPtr() && iController.UiConfigManagerPtr()->IsLocationSupported() )
       
   452             {
       
   453             TBool location ;
       
   454 			//Never save location information in second camera
       
   455 			if(iController.ActiveCamera() == ECamActiveCameraSecondary)
       
   456 				  {
       
   457 				  location = EFalse;
       
   458 				  }
       
   459 			else
       
   460 				  {
       
   461 				  location = iController.IntegerSettingValue( ECamSettingItemRecLocation );
       
   462 				  }
       
   463             iHarvesterClient.HarvestFile( aFilename,
       
   464                                           harvestAlbumIds,
       
   465                                           location );
       
   466             }
       
   467         else
       
   468             {
       
   469             iHarvesterClient.HarvestFile( aFilename,
       
   470                                           harvestAlbumIds,
       
   471                                           EFalse );
       
   472             }
       
   473 #else // RD_MDS_2_5
       
   474         iHarvesterClient.HarvestFile( aFilename,
       
   475                                       harvestAlbumIds );
       
   476 #endif // RD_MDS_2_5
       
   477         
       
   478         PRINT( _L("Camera <> iHarvesterClient.HarvestFile returned") );
       
   479         }
       
   480     harvestAlbumIds.Close();
       
   481 
       
   482     PRINT( _L("Camera <= CCamImageSaveActive::AddToAlbum") );
       
   483     OstTrace0( CAMERAAPP_PERFORMANCE_DETAIL, DUP1_CCAMIMAGESAVEACTIVE_ADDTOALBUM, "e_CCamImageSaveActive_AddToAlbum 0" );
       
   484     }
       
   485 #else // defined(RD_MDS_2_5) && !defined(__WINSCW__) && !defined(__WINS__)
       
   486 void CCamImageSaveActive::AddToAlbum( const TDesC&  /*aFilename*/,
       
   487                                       const TBool   /*aAddToAlbum*/,
       
   488                                       const TUint32 /*aDefaultAlbumId*/ )
       
   489     {
       
   490     }
       
   491 #endif // defined(RD_MDS_2_5) && !defined(__WINSCW__) && !defined(__WINS__)
       
   492 
       
   493 // -----------------------------------------------------------------------------
       
   494 // CCamImageSaveActive::Count
       
   495 // The number of items in the saving array
       
   496 // -----------------------------------------------------------------------------
       
   497 //
       
   498 TInt CCamImageSaveActive::Count() const
       
   499     {
       
   500     return iSaveArray->Count();
       
   501     }
       
   502 
       
   503 // -----------------------------------------------------------------------------
       
   504 // CCamImageSaveActive::CCamImageSaveActive
       
   505 // C++ constructor
       
   506 // -----------------------------------------------------------------------------
       
   507 //
       
   508 CCamImageSaveActive::CCamImageSaveActive( MCamImageSaveObserver& aObserver,         
       
   509                                           CCamAppController&  aController )
       
   510     : CActive( EPriorityStandard ), iObserver( aObserver ), 
       
   511     iController( aController ),
       
   512     iFlushing( EFalse )
       
   513     {
       
   514     }
       
   515 
       
   516 // -----------------------------------------------------------------------------
       
   517 // CCamImageSaveActive::ConstructL
       
   518 // 2nd phase construction
       
   519 // -----------------------------------------------------------------------------
       
   520 //
       
   521 void CCamImageSaveActive::ConstructL()
       
   522     {
       
   523     PRINT( _L("Camera => CCamImageSaveActive::ConstructL") );
       
   524 
       
   525     iSaveArray = new( ELeave ) CDesCArraySeg( KArrayGranularity );
       
   526     iNameArray = new( ELeave ) CDesCArraySeg( KArrayGranularity );
       
   527     CActiveScheduler::Add( this );
       
   528 
       
   529     PRINT( _L("Camera <= CCamImageSaveActive::ConstructL") );
       
   530     }
       
   531 
       
   532 // -----------------------------------------------------------------------------
       
   533 // CCamImageSaveActive::SetActiveAndCompleteRequest
       
   534 // Schedule to run immediately
       
   535 // -----------------------------------------------------------------------------
       
   536 //
       
   537 void CCamImageSaveActive::SetActiveAndCompleteRequest()
       
   538     {
       
   539     SetActive();
       
   540     TRequestStatus* statusPtr = &iStatus;
       
   541     User::RequestComplete( statusPtr, KErrNone );
       
   542     }
       
   543 
       
   544 // -----------------------------------------------------------------------------
       
   545 // CCamImageSaveActive::DoCancel
       
   546 // Cancels the active object
       
   547 // -----------------------------------------------------------------------------
       
   548 //
       
   549 void CCamImageSaveActive::DoCancel()
       
   550     {
       
   551     PRINT( _L( "Camera => CCamImageSaveActive::DoCancel" ) );      
       
   552     iDismissNote = ETrue;
       
   553     if ( iWait.IsStarted() )
       
   554         {
       
   555         iWait.AsyncStop(); 
       
   556         }
       
   557     iDoCancel = EFalse;
       
   558     // if no new saves have been requested since the cancellation
       
   559     if ( iSaveArray->Count() == 0 )
       
   560         {
       
   561         CActive::Cancel();
       
   562         iSaveArray->Reset();
       
   563 
       
   564         ReleaseAllAndDestroy( iImageArray );
       
   565         }
       
   566     PRINT( _L( "Camera <= CCamImageSaveActive::DoCancel" ) );                
       
   567     }
       
   568 
       
   569 // -----------------------------------------------------------------------------
       
   570 // CCamImageSaveActive::RunL
       
   571 // Clean up after any previous save, then run the next pending save
       
   572 // -----------------------------------------------------------------------------
       
   573 //
       
   574 void CCamImageSaveActive::RunL()
       
   575     {
       
   576     PRINT( _L( "Camera => CCamImageSaveActive::RunL" ) ); 
       
   577     
       
   578     if( !iFlushing )
       
   579         {
       
   580         // if the progress note has been requested
       
   581         if ( iShowNote )
       
   582             {
       
   583             iShowNote = EFalse;
       
   584             DoDisplayProgressNoteL();
       
   585             }
       
   586         // if a save has just completed
       
   587         if ( iSaveCurrent )
       
   588             {
       
   589             CompleteSaveOperation( ETrue );
       
   590             //ReportToObserver( ECamSaveEventComplete );
       
   591             }
       
   592         else
       
   593             {
       
   594             // If cancellation has been requested
       
   595             if ( iDoCancel )
       
   596                 {
       
   597                 DoCancel();       
       
   598                 }
       
   599             }
       
   600         }
       
   601     else
       
   602         {
       
   603         iFlushing = EFalse;
       
   604         CompleteSaveOperation( EFalse );
       
   605         ReportToObserver( ECamSaveEventComplete );
       
   606         }
       
   607     
       
   608     if ( !iSaveCurrent )
       
   609         {
       
   610         // if there are more images to save
       
   611         if ( iSaveArray->Count() > 0 )
       
   612             {
       
   613             DoSaveL();
       
   614             }
       
   615         // if all saves are complete and the progress note needs to be dismissed
       
   616         else if ( iDismissNote )
       
   617             {
       
   618             DoDismissProgressNote();
       
   619             }
       
   620         else if ( iNameArray->Count() > 0 )
       
   621             {
       
   622             DoCreateThumbnailL();
       
   623             }    
       
   624         else // Do nothing
       
   625             {
       
   626             }
       
   627         }
       
   628     PRINT( _L( "Camera <= CCamImageSaveActive::RunL" ) ); 
       
   629     }
       
   630 
       
   631 // -----------------------------------------------------------------------------
       
   632 // CCamImageSaveActive::RunError
       
   633 //
       
   634 // -----------------------------------------------------------------------------
       
   635 //
       
   636 TInt
       
   637 CCamImageSaveActive::RunError( TInt aError )
       
   638   {
       
   639   PRINT1( _L( "Camera => CCamImageSaveActive::RunError, error(%d)"), aError ); 
       
   640   Cancel();
       
   641 
       
   642   if( aError == KErrDiskFull || aError == KErrNotReady )
       
   643     {
       
   644     if( aError == KErrNotReady  )
       
   645       {
       
   646       iController.SetCaptureStoppedForUsb( ETrue );
       
   647       }
       
   648     
       
   649     ReportToObserver( ECamSaveEventSaveError );  
       
   650     }
       
   651   else
       
   652     {
       
   653     ReportToObserver( ECamSaveEventCriticalError );  
       
   654     }
       
   655 
       
   656   PRINT ( _L( "Camera <= CCamImageSaveActive::RunError") );
       
   657   return KErrNone;
       
   658   }
       
   659 
       
   660 // -----------------------------------------------------------------------------
       
   661 // CCamImageSaveActive::CompleteSaveOperation
       
   662 // Clean up after the previous save
       
   663 // -----------------------------------------------------------------------------
       
   664 //
       
   665 void CCamImageSaveActive::CompleteSaveOperation( TBool aDoFlush )
       
   666     {
       
   667     OstTrace0( CAMERAAPP_PERFORMANCE_DETAIL, DUP1_CCAMIMAGESAVEACTIVE_COMPLETESAVEOPERATION, "e_CCamImageSaveActive_CompleteSaveOperation 1" );
       
   668     PRINT( _L( "Camera => CCamImageSaveActive::CompleteSaveOperation" ) );     
       
   669     if( aDoFlush )
       
   670         {
       
   671         iFile.Flush(iStatus);
       
   672         iFlushing = ETrue;
       
   673         SetActive();
       
   674         }
       
   675     else
       
   676         {
       
   677         iSaveProgressCount++;
       
   678         // if the saving progress note is open
       
   679         if ( iSaveProgressDialog && iSaveProgressInfo )
       
   680             {
       
   681             // Reset inactivity timer.  Need to call this periodically 
       
   682             // to keep the backlight on
       
   683             User::ResetInactivityTime();
       
   684             // Increment the progress in the progress bar
       
   685             iSaveProgressInfo->IncrementAndDraw( 1 );
       
   686             }
       
   687         iSaveCurrent = EFalse;
       
   688         iFile.Close();
       
   689         // If there is an error or a pending request for deletion
       
   690         if ( iDeleteCurrent || iStatus != KErrNone )
       
   691             {
       
   692             RFs fs = CEikonEnv::Static()->FsSession();
       
   693             fs.Delete( iSaveArray->MdcaPoint( 0 ) );
       
   694             ReportToObserver( ECamSaveEventDeleted );
       
   695             }
       
   696         else // the save is successful, add to album if required
       
   697             {
       
   698             PERF_EVENT_END_L2( EPerfEventSaveImage );         
       
   699     
       
   700             AddToAlbum( iSaveArray->MdcaPoint( 0 ), 
       
   701                         iAddImageToAlbum, 
       
   702                         iDefaultAlbumId );
       
   703     
       
   704             // report to LifeBlog
       
   705             RProperty::Set( KPSUidCamcorderNotifier, KCamLatestFilePath, iSaveArray->MdcaPoint( 0 ) ); 
       
   706             }
       
   707     
       
   708         iDeleteCurrent = EFalse;
       
   709         
       
   710         // Delete the item from the saving arrays
       
   711         iSaveArray->Delete( 0 );
       
   712         iSaveArray->Compress();
       
   713     
       
   714         CCamBufferShare* share = iImageArray[0];
       
   715         iImageArray.Remove( 0 );
       
   716         if( share )
       
   717           {
       
   718           share->Release();
       
   719           share = NULL;
       
   720           }
       
   721         iImageArray.Compress();
       
   722     
       
   723         // If cancellation has been requested
       
   724         if ( iDoCancel )
       
   725             {
       
   726             DoCancel();       
       
   727             }
       
   728         OstTrace0( CAMERAAPP_PERFORMANCE, CCAMIMAGESAVEACTIVE_COMPLETESAVEOPERATION, "e_CAM_APP_SAVE 0" ); 
       
   729         }
       
   730     PRINT1( _L("Camera <> CCamImageSaveActive .. After this file saving, total shared buffers in use: %d"), CCamBufferShare::TotalBufferShareCount() );
       
   731     PRINT( _L( "Camera <= CCamImageSaveActive::CompleteSaveOperation" ) );         
       
   732     OstTrace0( CAMERAAPP_PERFORMANCE_DETAIL, DUP2_CCAMIMAGESAVEACTIVE_COMPLETESAVEOPERATION, "e_CCamImageSaveActive_CompleteSaveOperation 0" );
       
   733     }
       
   734 
       
   735 // -----------------------------------------------------------------------------
       
   736 // CCamImageSaveActive::DoSaveL
       
   737 // Start a saving operation
       
   738 // -----------------------------------------------------------------------------
       
   739 //
       
   740 void 
       
   741 CCamImageSaveActive::DoSaveL()
       
   742   {
       
   743   PERF_EVENT_START_L2( EPerfEventSaveImage );    
       
   744   PRINT( _L( "Camera => CCamImageSaveActive::DoSaveL" ) );     
       
   745   OstTrace0( CAMERAAPP_PERFORMANCE, CCAMIMAGESAVEACTIVE_DOSAVEL, "e_CAM_APP_SAVE 1" );  //CCORAPP_SAVE_START
       
   746   
       
   747   TPtrC filename = iSaveArray->MdcaPoint( 0 );
       
   748 
       
   749   PRINT1( _L( "Camera <> CCamImageSaveActive: trying to save file:[%S]"), &filename );     
       
   750 
       
   751   // Check disk space
       
   752   TInt drive = 0;
       
   753   __ASSERT_ALWAYS( !RFs::CharToDrive( filename[0], drive ),
       
   754       CamPanic( ECamPanicFileSystemError ) );
       
   755 
       
   756   RFs& fs = CEikonEnv::Static()->FsSession();
       
   757 
       
   758   TDesC8* data    = iImageArray[0]->SharedBuffer()->DataL( 0 );
       
   759   TBool   noSpace = SysUtil::DiskSpaceBelowCriticalLevelL( &fs, 
       
   760                                                            data->Length(), 
       
   761                                                            drive );
       
   762   if( noSpace )
       
   763     {
       
   764     Cancel();
       
   765     PRINT( _L( "Camera <> CCamImageSaveActive::DoSaveL .. [WARNING] Disk space below critical, LEAVE!" ) );     
       
   766     User::Leave( KErrDiskFull );
       
   767     }
       
   768 
       
   769   // The dummy file is read only for protection, make it writable now
       
   770   // Also unhide it so that media gallery can detect it
       
   771   fs.SetAtt( filename, 0, KEntryAttReadOnly|KEntryAttHidden );
       
   772 
       
   773   // Open the file
       
   774   TInt err = iFile.Open( fs, filename, EFileWrite );
       
   775 
       
   776   // if the file does not exist, create a new one
       
   777   if ( err == KErrNotFound )
       
   778       {
       
   779       User::LeaveIfError( iFile.Create( fs, filename, EFileWrite ) );
       
   780       }
       
   781   // if there was any other problem then leave
       
   782   else if ( err != KErrNone )
       
   783       {
       
   784       User::Leave( err );
       
   785       }
       
   786   // the file exists
       
   787   else
       
   788       {
       
   789       // Make sure the file is at the start
       
   790       TInt seek = 0;
       
   791       User::LeaveIfError( iFile.Seek( ESeekStart, seek ) );
       
   792       }
       
   793 
       
   794   if( iController.CurrentMode() == ECamControllerVideo )
       
   795       {
       
   796       // set size 
       
   797       User::LeaveIfError( iFile.SetSize( data->Size() ) );
       
   798       }
       
   799   // Write the image data to file
       
   800   PRINT( _L( "Camera call iFile.Write" ) );     
       
   801   iFile.Write( *(data), iStatus );
       
   802   iSaveCurrent = ETrue;
       
   803   SetActive();
       
   804   PRINT( _L( "Camera <= CCamImageSaveActive::DoSaveL" ) );     
       
   805   }
       
   806 
       
   807 // -----------------------------------------------------------------------------
       
   808 // CCamImageSaveActive::DoDisplayProgressNoteL
       
   809 // Display the saving progress note
       
   810 // -----------------------------------------------------------------------------
       
   811 //
       
   812 void CCamImageSaveActive::DoDisplayProgressNoteL()
       
   813     {
       
   814     PRINT( _L("Camera => CCamImageSaveActive::DoDisplayProgressNoteL") )
       
   815     __ASSERT_DEBUG( iSaveProgressDialog == NULL , CamPanic( ECamPanicUi ) );
       
   816     TBool reportOnExit = ETrue;
       
   817     // if there are images left to save in this burst set
       
   818     if ( iExpectedImages > iSaveProgressCount )
       
   819         {
       
   820         iSaveProgressDialog = new( ELeave ) CAknProgressDialog( 
       
   821             reinterpret_cast<CEikDialog**>( &iSaveProgressDialog ), ETrue );
       
   822         iSaveProgressDialog->PrepareLC( R_CAM_SAVING_IMAGES_PROGRESS_NOTE );
       
   823         iSaveProgressInfo = iSaveProgressDialog->GetProgressInfoL();
       
   824         iSaveProgressInfo->SetFinalValue( iExpectedImages );
       
   825         TInt i;
       
   826         for ( i = 0; i < iSaveProgressCount; i++ )
       
   827             {
       
   828             // Increment the progress in the bar for previous saves
       
   829             iSaveProgressInfo->IncrementAndDraw( 1 );
       
   830             }
       
   831         // display the dialog and wait until it is dismissed
       
   832         TInt exit = iSaveProgressDialog->RunLD();
       
   833         // the dialog has exited and deleted itself
       
   834         iSaveProgressDialog = NULL;
       
   835         iSaveProgressInfo = NULL;
       
   836         // if the dialog was cancelled by the user
       
   837         if ( exit == 0 )
       
   838             {
       
   839             reportOnExit = EFalse;
       
   840             iCompletedBurst = ETrue;                
       
   841             }
       
   842         }
       
   843     // if the burst has now completed
       
   844     if ( reportOnExit )
       
   845         {
       
   846         ReportToObserver( ECamSaveEventBurstComplete );            
       
   847         }
       
   848     }
       
   849 
       
   850 // -----------------------------------------------------------------------------
       
   851 // CCamImageSaveActive::DoDismissProgressNote
       
   852 // Dismiss the progress note, if it is still open
       
   853 // -----------------------------------------------------------------------------
       
   854 //
       
   855 void CCamImageSaveActive::DoDismissProgressNote()
       
   856     {
       
   857     iDismissNote = EFalse;
       
   858     if ( iSaveProgressDialog )
       
   859         {
       
   860         // Delete the dialog and end its RunLD()
       
   861         TRAPD( error, iSaveProgressDialog->ProcessFinishedL() ) 
       
   862         if (error != KErrNone)
       
   863             {
       
   864             delete iSaveProgressDialog;
       
   865             iSaveProgressDialog = NULL;
       
   866             iSaveProgressInfo = NULL;
       
   867             }
       
   868         }
       
   869     // if the progress note is still pending
       
   870     if ( iShowNote )
       
   871         {
       
   872         // report that the burst has completed
       
   873         iShowNote = EFalse;
       
   874         ReportToObserver( ECamSaveEventBurstComplete );                   
       
   875         }
       
   876     }
       
   877 
       
   878 // -----------------------------------------------------------------------------
       
   879 // CCamImageSaveActive::ReportToObserver
       
   880 // Indicate to the observer that saving has finished
       
   881 // -----------------------------------------------------------------------------
       
   882 //
       
   883 void CCamImageSaveActive::ReportToObserver( TCamSaveEvent aEvent )
       
   884     {
       
   885     if ( aEvent == ECamSaveEventComplete && iCompletedBurst )
       
   886         {
       
   887         aEvent = ECamSaveEventBurstComplete;
       
   888         iCompletedBurst = EFalse;
       
   889         }    
       
   890     iObserver.HandleSaveEvent( aEvent );    
       
   891     }
       
   892 
       
   893 
       
   894 // -----------------------------------------------------------------------------
       
   895 // ReleaseAllAndDestroy
       
   896 //
       
   897 // -----------------------------------------------------------------------------
       
   898 //
       
   899 void 
       
   900 CCamImageSaveActive::ReleaseAllAndDestroy( RPointerArray<CCamBufferShare>& aArray )
       
   901   {
       
   902   PRINT( _L("Camera => CCamImageSaveActive::ReleaseAllAndDestroy") );
       
   903 
       
   904   for( TInt i = aArray.Count()-1; i >= 0; i-- )
       
   905     {
       
   906     CCamBufferShare* share = aArray[i];
       
   907     aArray.Remove( i );
       
   908     if( share )
       
   909       {
       
   910       share->Release();
       
   911       share = NULL;
       
   912       }
       
   913     }
       
   914 
       
   915   __ASSERT_DEBUG( aArray.Count() == 0, User::Invariant() );
       
   916 
       
   917   // All the data is released.
       
   918   // CCamBufferShare destructor is not public, so cannot call ResetAndDestroy.
       
   919   aArray.Reset();
       
   920 
       
   921   PRINT( _L("Camera <= CCamImageSaveActive::ReleaseAllAndDestroy") );
       
   922   }
       
   923 
       
   924 #if defined(RD_MDS_2_5) && !defined(__WINSCW__) && !defined(__WINS__)
       
   925 // -----------------------------------------------------------------------------
       
   926 // HarvestingComplete
       
   927 //
       
   928 // Call Back method from the harvesting client once the harvesting is complete
       
   929 // -----------------------------------------------------------------------------
       
   930 //
       
   931 void CCamImageSaveActive::HarvestingComplete( TDesC& aURI
       
   932 #ifdef RD_MDS_2_5        
       
   933                                             , TInt aError 
       
   934 #endif // RD_MDS_2_5
       
   935                                              )
       
   936     {
       
   937     PRINT( _L("Camera => CCamImageSaveActive::HarvestingComplete") );
       
   938 #ifdef RD_MDS_2_5        
       
   939     PRINT1( _L("Camera <> aError = %d"), aError );
       
   940 
       
   941     if ( iController.UiConfigManagerPtr() && 
       
   942          iController.UiConfigManagerPtr()->IsThumbnailManagerAPISupported() && 
       
   943          iSnapArray.Count() &&
       
   944          iNameArray->Count() )
       
   945         {
       
   946         TRAP_IGNORE( DoCreateThumbnailL() ); 
       
   947         }
       
   948 
       
   949 #endif // RD_MDS_2_5
       
   950     iObserver.HandleFileHarvestingComplete();
       
   951     PRINT( _L("Camera <= CCamImageSaveActive::HarvestingComplete") );
       
   952     }
       
   953 
       
   954 //
       
   955 //CCamImageSaveActive::DeRegisterHarverterClientEvents
       
   956 //
       
   957 void CCamImageSaveActive::DeRegisterHarverterClientEvents()
       
   958     {
       
   959     PRINT( _L("Camera => CCamImageSaveActive::DeRegisterHarverterClientEvents") );
       
   960 
       
   961     if ( iRegisteredForHarvesterEvents && iHarvesterClientConnected )
       
   962         {
       
   963         iHarvesterClient.RemoveObserver( this );
       
   964         iRegisteredForHarvesterEvents = EFalse;
       
   965         }
       
   966     else
       
   967         {
       
   968         // do nothing
       
   969         }
       
   970 
       
   971     PRINT( _L("Camera <= CCamImageSaveActive::DeRegisterHarverterClientEvents") );
       
   972     }
       
   973 
       
   974 
       
   975 //
       
   976 //CCamImageSaveActive::RegisterForHarvesterEvents
       
   977 //
       
   978 void CCamImageSaveActive::RegisterForHarvesterEvents()
       
   979     {
       
   980     PRINT( _L("Camera => CCamImageSaveActive::RegisterForHarvesterEvents") );
       
   981 
       
   982     if ( !iRegisteredForHarvesterEvents && iHarvesterClientConnected )
       
   983         {
       
   984         iHarvesterClient.SetObserver( this );
       
   985         iRegisteredForHarvesterEvents = ETrue;
       
   986         }
       
   987     else
       
   988         {
       
   989         // do nothing
       
   990         }
       
   991 
       
   992     PRINT( _L("Camera <= CCamImageSaveActive::RegisterForHarvesterEvents") );
       
   993     }
       
   994 
       
   995 #endif // defined(RD_MDS_2_5) && !defined(__WINSCW__) && !defined(__WINS__)
       
   996 
       
   997 // -----------------------------------------------------------------------------
       
   998 // CreateThumbnailsL
       
   999 //
       
  1000 // -----------------------------------------------------------------------------
       
  1001 //
       
  1002 void CCamImageSaveActive::CreateThumbnailsL( const CCamBurstCaptureArray& aArray )
       
  1003     {
       
  1004     PRINT( _L("Camera => CCamImageSaveActive::CreateThumbnailsL") );
       
  1005     TInt arrayCount = aArray.Count();
       
  1006     if ( !iSnapArray.Count() )
       
  1007       {
       
  1008       iThumbnailRequests.Reset();
       
  1009       iThumbnailRequests.ReserveL( arrayCount );
       
  1010       }
       
  1011     TInt count(0);
       
  1012     TInt err(0);
       
  1013     
       
  1014     for ( TInt i=0; i < arrayCount; i++ )
       
  1015         {
       
  1016         count = iNameArray->Count();        
       
  1017 
       
  1018         CFbsBitmap* snapshot = new( ELeave ) CFbsBitmap();
       
  1019         if ( aArray.Snapshot( i ) )
       
  1020             {
       
  1021             err = snapshot->Duplicate( aArray.Snapshot( i )->Handle() );
       
  1022             }
       
  1023         // in case the snapshot is missing, the newly created empty bitmap indicates
       
  1024         // the thumbnail is created using the imagefile    
       
  1025         if ( !err )
       
  1026             {
       
  1027             snapshot->SetDisplayMode( EColor64K );    
       
  1028             TRAP( err, iSnapArray.AppendL( snapshot ) );            
       
  1029             if ( !err ) 
       
  1030                 {
       
  1031                 //append filename (includes full path)
       
  1032                 PRINT1( _L("Camera <> CCamImageSaveActive::CreateThumbnails append file:%S"), &aArray.FileName( i ) );    
       
  1033                 TRAP( err, iNameArray->AppendL( aArray.FileName( i ) ) );
       
  1034                 if ( !err )
       
  1035                     {
       
  1036                     TRAP( err, iThumbnailRequests.AppendL( KErrNotFound ) );
       
  1037                     }
       
  1038                 }
       
  1039             if ( err  )
       
  1040                 {
       
  1041                 if ( iNameArray->Count() > count )
       
  1042                     {
       
  1043                     iNameArray->Delete( count );
       
  1044                     }
       
  1045                 if ( iSnapArray.Count() > count )
       
  1046                     {
       
  1047                     iSnapArray.Remove( count );
       
  1048                     }
       
  1049                 if ( iThumbnailRequests.Count() > count )
       
  1050                     {
       
  1051                     iThumbnailRequests.Remove( count );
       
  1052                     }
       
  1053                 }
       
  1054             }
       
  1055         }     
       
  1056     PRINT( _L("Camera <= CCamImageSaveActive::CreateThumbnailsL") );
       
  1057     }
       
  1058 
       
  1059 // -----------------------------------------------------------------------------
       
  1060 // CCamImageSaveActive::DoCreateThumbnail
       
  1061 // Add images to album
       
  1062 // -----------------------------------------------------------------------------
       
  1063 //
       
  1064 void CCamImageSaveActive::DoCreateThumbnailL()
       
  1065     {
       
  1066     PRINT( _L( "Camera => CCamImageSaveActive::DoCreateThumbnailL" ) );     
       
  1067     if( !iManager )
       
  1068         {
       
  1069         PRINT( _L( "Camera <> CCamImageSaveActive::DoCreateThumbnail create manager" ) );         
       
  1070         iManager = CThumbnailManager::NewL( *this );
       
  1071         }
       
  1072     // create object and call thumbnailmanager
       
  1073     TSize size = iSnapArray[ 0 ]->SizeInPixels();
       
  1074     CThumbnailObjectSource* source;
       
  1075     if ( size.iHeight == 0 || size.iWidth == 0 )
       
  1076         {
       
  1077         PRINT( _L( "Camera <> CCamImageSaveActive::DoCreateThumbnail only URI" ) );         
       
  1078         source = CThumbnailObjectSource::NewL( iNameArray->MdcaPoint( 0 ), 
       
  1079                                                KNullDesC );
       
  1080         }
       
  1081     else
       
  1082         {
       
  1083         PRINT( _L( "Camera <> CCamImageSaveActive::DoCreateThumbnail URI and bitmap" ) );             
       
  1084         source = CThumbnailObjectSource::NewL( iSnapArray[ 0 ], 
       
  1085                                                iNameArray->MdcaPoint( 0 ) );
       
  1086         }
       
  1087     PRINT1( _L("Camera <> CCamImageSaveActive::DoCreateThumbnailL  filename:%S"), &iNameArray->MdcaPoint( 0 ) );        
       
  1088     CleanupStack::PushL( source );        
       
  1089     TThumbnailRequestId requestId = iManager->CreateThumbnails( *source );
       
  1090     TInt index = iThumbnailRequests.Count() - iSnapArray.Count();
       
  1091     PRINT2( _L( "Camera <> CCamImageSaveActive::DoCreateThumbnailL array index=%d, request id=%d" ), index, requestId );
       
  1092     iThumbnailRequests[index] = requestId;
       
  1093     CleanupStack::PopAndDestroy( source );
       
  1094 
       
  1095     iNameArray->Delete( 0 );
       
  1096     iNameArray->Compress();
       
  1097 
       
  1098     iSnapArray.Remove( 0 );
       
  1099     iSnapArray.Compress();
       
  1100 
       
  1101     if ( !IsActive() && iNameArray->Count() > 0  )
       
  1102         {
       
  1103         SetActiveAndCompleteRequest();
       
  1104         }
       
  1105     PRINT( _L( "Camera <= CCamImageSaveActive::DoCreateThumbnailL" ) );         
       
  1106     }
       
  1107 
       
  1108 void CCamImageSaveActive::CancelThumbnail( TInt aSnapshotIndex )
       
  1109     {
       
  1110     PRINT1( _L( "Camera => CCamImageSaveActive::CancelThumbnail - aSnapshotIndex=%d" ), aSnapshotIndex );
       
  1111     if ( aSnapshotIndex >= iThumbnailRequests.Count() )
       
  1112         {
       
  1113         PRINT( _L( "Camera <= CCamImageSaveActive::CancelThumbnail request array not initialized yet" ) );
       
  1114         return;
       
  1115         }
       
  1116     TThumbnailRequestId requestId = iThumbnailRequests[aSnapshotIndex];
       
  1117     if ( requestId != KErrNotFound )
       
  1118         {
       
  1119         if ( iManager )
       
  1120             {
       
  1121             PRINT1( _L( "Camera <> CCamImageSaveActive::CancelThumbnail canceling request %d"), requestId );
       
  1122             TInt err = iManager->CancelRequest( requestId );
       
  1123             PRINT1( _L( "Camera <> CCamImageSaveActive::CancelThumbnail CancelRequest() returned %d"), err );
       
  1124             iThumbnailRequests[aSnapshotIndex] = KErrNotFound;
       
  1125             }
       
  1126         }
       
  1127     PRINT( _L( "Camera <= CCamImageSaveActive::CancelThumbnail" ) );
       
  1128     }
       
  1129 void CCamImageSaveActive::ThumbnailPreviewReady( MThumbnailData& aThumbnail, 
       
  1130                                                  TThumbnailRequestId aId )
       
  1131     {
       
  1132 	// empty implementation
       
  1133     }                                                 
       
  1134           
       
  1135 void CCamImageSaveActive::ThumbnailReady( TInt aError, 
       
  1136                                           MThumbnailData& aThumbnail, 
       
  1137                                           TThumbnailRequestId aId )
       
  1138     {
       
  1139     PRINT1( _L( "Camera => CCamImageSaveActive::ThumbnailReady aId=%d" ), aId );
       
  1140     for ( TInt i = 0; i < iThumbnailRequests.Count(); i++ )
       
  1141         {
       
  1142         if ( iThumbnailRequests[i] == aId )
       
  1143             {
       
  1144             PRINT1( _L( "Camera <> CCamImageSaveActive::ThumbnailReady thumbnail for snapshot %d ready" ), i );
       
  1145             iThumbnailRequests[i] = KErrNotFound;
       
  1146             }
       
  1147         }
       
  1148     PRINT( _L( "Camera <= CCamImageSaveActive::ThumbnailReady" ) );
       
  1149     }
       
  1150                                               
       
  1151 //  End of File