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