mobilemessaging/unieditor/application/src/UniEditorProcessImageOperation.cpp
changeset 79 2981cb3aa489
equal deleted inserted replaced
25:84d9eb65b26f 79:2981cb3aa489
       
     1 /*
       
     2 * Copyright (c) 2006,2007 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:   Provides CUniEditorProcessImageOperation methods.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 // ========== INCLUDE FILES ================================
       
    21 
       
    22 #include <apmstd.h>
       
    23 
       
    24 #include <icl/imagedata.h>
       
    25 
       
    26 #include <centralrepository.h>
       
    27 
       
    28 #include <messagingvariant.hrh>
       
    29 #include <messaginginternalcrkeys.h> // for Central Repository keys
       
    30 
       
    31 #include <MsgMediaResolver.h>
       
    32 #include <MsgImageInfo.h>
       
    33 #include <MmsConformance.h>
       
    34 #include <MsgMimeTypes.h>
       
    35 
       
    36 #include <uniimageprocessor.h>
       
    37 #include <unimsventry.h>
       
    38 
       
    39 #include <mmsvattachmentmanager.h>
       
    40 #include <mmsvattachmentmanagersync.h>
       
    41 #include <cmsvattachment.h>
       
    42 
       
    43 #include <msgtextutils.h>
       
    44 
       
    45 #include <mmssettingsdefs.h>
       
    46 
       
    47 #include <mmsversion.h>
       
    48 
       
    49 #include "UniClientMtm.h"
       
    50 #include "UniEditorEnum.h"
       
    51 #include "UniEditorDocument.h"
       
    52 #include "UniEditorProcessImageOperation.h"
       
    53 
       
    54 // ========== CONSTANTS ====================================
       
    55 
       
    56 // Leave some space after compression so that text can be inserted to the 
       
    57 // message.
       
    58 const TInt KUniCompressionMargin = 10 * 1024; // 10 kB
       
    59 
       
    60 const TInt KUniMmsUploadImageWidth = 1600;
       
    61 const TInt KUniMmsUploadImageHeight = 1200;
       
    62 
       
    63 
       
    64 _LIT8( KUniExtImageJpeg_8, ".jpg" );
       
    65 _LIT8( KUniExtImageGif_8,  ".gif" );
       
    66 
       
    67 // ========== MEMBER FUNCTIONS =============================
       
    68 
       
    69 // ---------------------------------------------------------
       
    70 // CUniEditorProcessImageOperation::NewL
       
    71 //
       
    72 // Factory method.
       
    73 // ---------------------------------------------------------
       
    74 //
       
    75 CUniEditorProcessImageOperation* CUniEditorProcessImageOperation::NewL( 
       
    76         MUniEditorOperationObserver& aObserver,
       
    77         CUniEditorDocument& aDocument,
       
    78         RFs& aFs )
       
    79     {
       
    80     CUniEditorProcessImageOperation* self = new ( ELeave ) CUniEditorProcessImageOperation(
       
    81             aObserver,
       
    82             aDocument,
       
    83             aFs );
       
    84             
       
    85     CleanupStack::PushL( self );
       
    86     self->ConstructL();
       
    87     CleanupStack::Pop( self );
       
    88     
       
    89     return self;
       
    90     }
       
    91 
       
    92 // ---------------------------------------------------------
       
    93 // CUniEditorProcessImageOperation::CUniEditorProcessImageOperation.
       
    94 // ---------------------------------------------------------
       
    95 //
       
    96 CUniEditorProcessImageOperation::CUniEditorProcessImageOperation(
       
    97         MUniEditorOperationObserver& aObserver,
       
    98         CUniEditorDocument& aDocument,
       
    99         RFs& aFs ) :
       
   100     CUniEditorOperation( aObserver, aDocument, aFs, EUniEditorOperationProcessImage ),
       
   101     iNewAttaId( KMsvNullIndexEntryId )
       
   102     {
       
   103     }
       
   104 
       
   105 // ---------------------------------------------------------
       
   106 // CUniEditorProcessImageOperation::ConstructL
       
   107 //
       
   108 // 2nd phase constructor.
       
   109 // ---------------------------------------------------------
       
   110 //
       
   111 void CUniEditorProcessImageOperation::ConstructL()
       
   112     {
       
   113     BaseConstructL();
       
   114 
       
   115     TInt featureBitmask( 0 );
       
   116     
       
   117     CRepository* repository = CRepository::NewL( KCRUidMuiuVariation );
       
   118     repository->Get( KMuiuMmsFeatures, featureBitmask );
       
   119     
       
   120     iExactImageScaling = ( featureBitmask & KMmsFeatureIdExactImageScaling );
       
   121     
       
   122     delete repository;
       
   123     }
       
   124 
       
   125 // ---------------------------------------------------------
       
   126 // CUniEditorProcessImageOperation::~CUniEditorProcessImageOperation
       
   127 // ---------------------------------------------------------
       
   128 //
       
   129 CUniEditorProcessImageOperation::~CUniEditorProcessImageOperation()
       
   130     {
       
   131     Cancel();
       
   132     
       
   133     delete iNewImageInfo;
       
   134     iNewImageFile.Close();
       
   135     delete iEditStore;
       
   136     delete iImageProcessor;
       
   137     }
       
   138 
       
   139 // ---------------------------------------------------------
       
   140 // CUniEditorProcessImageOperation::Process
       
   141 // ---------------------------------------------------------
       
   142 //
       
   143 void CUniEditorProcessImageOperation::Process( CMsgImageInfo* aImageInfo,
       
   144                                                TMsvAttachmentId aAttachmentId,
       
   145                                                TInt aMessageSize )
       
   146     {
       
   147     ResetErrors();
       
   148     
       
   149     iImageInfo = aImageInfo;
       
   150     iAttachmentId = aAttachmentId;
       
   151     iMessageSize = aMessageSize;
       
   152     iOperationState = EUniProcessImgCheck;
       
   153     
       
   154     CompleteSelf( KErrNone );
       
   155     }
       
   156 
       
   157 // ---------------------------------------------------------
       
   158 // CUniEditorProcessImageOperation::DetachAttachmentId
       
   159 // ---------------------------------------------------------
       
   160 //
       
   161 void CUniEditorProcessImageOperation::DetachAttachmentId( TMsvAttachmentId& aAttachmentId )
       
   162     {
       
   163     // iNewImageInfo may be already detached in DetachImageInfo
       
   164     aAttachmentId = iNewAttaId;
       
   165     iNewAttaId = KMsvNullIndexEntryId;
       
   166     }
       
   167 
       
   168 // ---------------------------------------------------------
       
   169 // CUniEditorProcessImageOperation::RunL
       
   170 // ---------------------------------------------------------
       
   171 //
       
   172 void CUniEditorProcessImageOperation::RunL()
       
   173     {
       
   174     PrintOperationAndState();
       
   175     if ( iStatus.Int() != KErrNone )
       
   176         {
       
   177         SetError( iStatus.Int() );
       
   178         iOperationState = EUniProcessImgError;
       
   179         }
       
   180     
       
   181     switch ( iOperationState )
       
   182         {
       
   183         case EUniProcessImgCheck:
       
   184             {
       
   185             DoStartCheck();
       
   186             break;
       
   187             }
       
   188         case EUniProcessImgProcess:
       
   189             {
       
   190             DoStartProcessL();
       
   191             break;
       
   192             }
       
   193         case EUniProcessImgResolve:
       
   194             {
       
   195             DoStartResolveL();
       
   196             break;
       
   197             }
       
   198         case EUniProcessImgReady:
       
   199             {
       
   200             iObserver.EditorOperationEvent( EUniEditorOperationProcessImage,
       
   201                                             EUniEditorOperationComplete );
       
   202             break;
       
   203             }
       
   204         case EUniProcessImgError:
       
   205             {
       
   206             DoErrorWithoutStateChange();
       
   207             iObserver.EditorOperationEvent( EUniEditorOperationProcessImage,
       
   208                                             EUniEditorOperationError );
       
   209             break;
       
   210             }
       
   211         default:
       
   212             {
       
   213             iObserver.EditorOperationEvent( EUniEditorOperationProcessImage,
       
   214                                             EUniEditorOperationError );
       
   215             break;
       
   216             }
       
   217         }    
       
   218     }
       
   219 
       
   220 // ---------------------------------------------------------
       
   221 // CUniEditorProcessImageOperation::DoCancelCleanup
       
   222 // ---------------------------------------------------------
       
   223 //
       
   224 void CUniEditorProcessImageOperation::DoCancelCleanup()
       
   225     {
       
   226     if ( iImageProcessor )
       
   227         {
       
   228         iImageProcessor->Cancel();
       
   229         }
       
   230         
       
   231     DoErrorWithoutStateChange();
       
   232     }
       
   233 
       
   234 // ---------------------------------------------------------
       
   235 // CUniEditorProcessImageOperation::DoStartCheck
       
   236 // ---------------------------------------------------------
       
   237 //
       
   238 void CUniEditorProcessImageOperation::DoStartCheck()
       
   239     {
       
   240     if ( !CheckNeedToProcess() )
       
   241         {
       
   242         iOperationState = EUniProcessImgError;
       
   243         }
       
   244     else if ( iProcessMethod == EUniProcessImgMethodNone )
       
   245         {
       
   246         iOperationState = EUniProcessImgReady;
       
   247         }
       
   248     else
       
   249         {
       
   250         iOperationState = EUniProcessImgProcess;
       
   251         }
       
   252     CompleteSelf( KErrNone );
       
   253     }
       
   254   
       
   255 // ---------------------------------------------------------
       
   256 // CUniEditorProcessImageOperation::DoStartProcessL
       
   257 // ---------------------------------------------------------
       
   258 //
       
   259 void CUniEditorProcessImageOperation::DoStartProcessL()
       
   260     {
       
   261     CreateEmptyAttachmentL();
       
   262     
       
   263     if ( !iImageProcessor )
       
   264         {
       
   265         iImageProcessor = new( ELeave )CUniImageProcessor( this );
       
   266         }
       
   267         
       
   268     RFile sourceFile = OpenFileForReadingL();
       
   269     
       
   270     CleanupClosePushL( sourceFile );
       
   271     
       
   272     iImageProcessor->ProcessImageL( sourceFile,
       
   273                                     iNewImageFile,
       
   274                                     iScaleSize,
       
   275                                     iTargetType.Des8(),
       
   276                                     ETrue, // Always maintain aspect ratio
       
   277                                     iDocument.MaxMessageSize() - KUniCompressionMargin );
       
   278     SetPending();
       
   279                    
       
   280     CleanupStack::PopAndDestroy(); // sourceFile;
       
   281     }
       
   282   
       
   283 // ---------------------------------------------------------
       
   284 // CUniEditorProcessImageOperation::DoStartResolveL
       
   285 // ---------------------------------------------------------
       
   286 //
       
   287 void CUniEditorProcessImageOperation::DoStartResolveL()
       
   288     {
       
   289     iNewImageInfo = static_cast<CMsgImageInfo*>(iDocument.DataModel()->MediaResolver().CreateMediaInfoL( iNewImageFile ) );
       
   290     iDocument.DataModel()->MediaResolver().ParseInfoDetailsL( iNewImageInfo, iNewImageFile );
       
   291 
       
   292     iOperationState = EUniProcessImgReady;
       
   293 
       
   294     iNewImageFile.Close();
       
   295     
       
   296     __ASSERT_DEBUG( iEditStore, Panic( EUniNullPointer ) );
       
   297     
       
   298     iEditStore->CommitL();
       
   299     delete iEditStore;
       
   300     iEditStore = NULL;
       
   301 
       
   302     CompleteSelf( KErrNone );
       
   303     }
       
   304 
       
   305 // ---------------------------------------------------------
       
   306 // CUniEditorProcessImageOperation::DoErrorWithoutStateChange
       
   307 // ---------------------------------------------------------
       
   308 //
       
   309 void CUniEditorProcessImageOperation::DoErrorWithoutStateChange()
       
   310     {
       
   311     iNewImageFile.Close();
       
   312     delete iNewImageInfo;
       
   313     iNewImageInfo = NULL;
       
   314     
       
   315     delete iEditStore;
       
   316     iEditStore = NULL;
       
   317     }
       
   318 
       
   319 // ---------------------------------------------------------
       
   320 // CUniEditorProcessImageOperation::ImageProcessingReady
       
   321 //
       
   322 // Image Compressor callback implementation.
       
   323 // ---------------------------------------------------------
       
   324 //
       
   325 void CUniEditorProcessImageOperation::ImageProcessingReady( TSize aBitmapSize, TInt aFileSize, TBool aCompressed )
       
   326     {
       
   327     TInt err = iImageProcessor->Error();
       
   328     
       
   329     if ( err == KErrNone &&
       
   330          ( aBitmapSize.iWidth == 0 || aBitmapSize.iHeight == 0 ||
       
   331            ( aCompressed &&
       
   332             ( aFileSize == 0 ||
       
   333               aFileSize > ( iDocument.MaxMessageSize() - KUniCompressionMargin ) ) ) ) )
       
   334         {
       
   335         err = KErrGeneral;
       
   336         }
       
   337         
       
   338     switch ( err )
       
   339         {
       
   340         case KErrNone:
       
   341             {
       
   342             iOperationState = EUniProcessImgResolve;
       
   343             if ( aCompressed )
       
   344                 {
       
   345                 SetError( EUniProcessImgCompressSuccessful );
       
   346                 }
       
   347             break;
       
   348             }
       
   349         case KErrNoMemory:
       
   350             {
       
   351             iOperationState = EUniProcessImgError;
       
   352             SetError( EUniProcessImgOutOfMemory );
       
   353             break;
       
   354             }
       
   355         case KErrDiskFull:
       
   356             {
       
   357             iOperationState = EUniProcessImgError;
       
   358             SetError( EUniProcessImgOutOfDisk );
       
   359             break;
       
   360             }
       
   361         case KErrNotFound:
       
   362             {
       
   363             iOperationState = EUniProcessImgError;
       
   364             SetError( EUniProcessImgNotFound );
       
   365             break;
       
   366             }
       
   367         default:
       
   368             {
       
   369             iOperationState = EUniProcessImgError;
       
   370             if ( aCompressed )
       
   371                 {
       
   372                 SetError( EUniProcessImgCompressFailed );
       
   373                 }
       
   374             else
       
   375                 {
       
   376                 SetError( EUniProcessImgScalingFailed );
       
   377                 }
       
   378             break;
       
   379             }
       
   380         }
       
   381     
       
   382     if ( err == KErrCancel )
       
   383         {
       
   384         CompleteOperation( KErrCancel );
       
   385         }
       
   386     else
       
   387         {
       
   388         CompleteOperation( KErrNone );
       
   389         }
       
   390     }
       
   391 
       
   392 // ---------------------------------------------------------
       
   393 // CUniEditorProcessImageOperation::CheckNeedToProcess
       
   394 // 
       
   395 // Checks if scaling/converting/compression is needed.
       
   396 // ---------------------------------------------------------
       
   397 //
       
   398 TBool CUniEditorProcessImageOperation::CheckNeedToProcess()
       
   399     {
       
   400     iProcessMethod = EUniProcessImgMethodNone;
       
   401     
       
   402     TMmsConformance conformance = 
       
   403         iDocument.DataModel()->MmsConformance().MediaConformance( *iImageInfo );
       
   404     
       
   405     if ( conformance.iCanAdapt == EFalse )
       
   406         {
       
   407         return ETrue;
       
   408         }
       
   409         
       
   410     TSize origSize = iImageInfo->Dimensions();
       
   411     
       
   412     if ( origSize.iWidth == 0 || origSize.iHeight == 0 )
       
   413         {    
       
   414         // Cannot get size -> corrupted
       
   415         SetError( EUniProcessImgCorrupted );
       
   416         return ETrue;
       
   417         }
       
   418     
       
   419     TSize scaleSize = ImageSendSize();
       
   420     TSize optimizedSize = origSize;
       
   421     
       
   422     while ( optimizedSize.iWidth > scaleSize.iWidth ||
       
   423             optimizedSize.iHeight > scaleSize.iHeight )
       
   424         {
       
   425         // Largest possible (1/2)^n size
       
   426         optimizedSize.iWidth >>= 1;
       
   427         optimizedSize.iHeight >>= 1;
       
   428         }
       
   429         
       
   430     if ( scaleSize.iWidth < origSize.iWidth ||
       
   431          scaleSize.iHeight < origSize.iHeight )
       
   432         {
       
   433         if ( !iExactImageScaling &&
       
   434             ( scaleSize.iWidth > KMmsUniImageSmallWidth ||
       
   435               scaleSize.iHeight > KMmsUniImageSmallHeight ) )
       
   436             {
       
   437             // Use optimized (1/2^n) size when scaling
       
   438             // to larger than "Small"
       
   439             scaleSize = optimizedSize;
       
   440             }
       
   441         // else -> scale to exact (non-optimized) size
       
   442         
       
   443         iProcessMethod |= EUniProcessImgMethodScale;
       
   444         }
       
   445     else
       
   446         {
       
   447         // Scaling not needed. Check possible conversion need.
       
   448         scaleSize = origSize;
       
   449         
       
   450         if ( conformance.iConfStatus & EMmsConfNokConversionNeeded )
       
   451             {
       
   452             // Conversion needed.
       
   453             iProcessMethod |= EUniProcessImgMethodConvert;
       
   454             }
       
   455         }
       
   456 
       
   457     if ( !( iProcessMethod & EUniProcessImgMethodScale ) &&
       
   458          ( iImageInfo->FileSize() + iMessageSize ) > iDocument.MaxMessageSize() &&
       
   459          iImageInfo->MimeType().CompareF( KMsgMimeImageJpeg ) == 0 &&
       
   460          iMessageSize < KUniCompressionMargin )
       
   461         {
       
   462         // Only compression needed as image is JPEG that is larger than can be fitted
       
   463         // into the message and scaling is not performed. Also current message size
       
   464         // is under comression margin.
       
   465         iProcessMethod |= EUniProcessImgMethodCompress;
       
   466         }
       
   467     
       
   468     TBool largeImageQuery = EFalse;
       
   469     TInt conformanceWidth = KImageRichWidth;
       
   470     TInt conformanceHeight = KImageRichHeight;
       
   471     
       
   472     if (iDocument.DataModel()->MmsConformance().ConformanceVersion()> KMmsVersion12)
       
   473         {
       
   474         conformanceWidth = KImageMegapixelWidth;
       
   475         conformanceHeight = KImageMegapixelHeight;    
       
   476         }
       
   477     
       
   478     if ( iProcessMethod == EUniProcessImgMethodNone )
       
   479         {
       
   480         // Image won't be processed
       
   481         if ( ( origSize.iWidth > conformanceWidth ||
       
   482                origSize.iHeight > conformanceHeight ) &&
       
   483              ( iImageInfo->FileSize() + iMessageSize ) < iDocument.MaxMessageSize() )
       
   484             {
       
   485             // Original image width or height is "non-conformant" and original image would 
       
   486             // fit to into the message without any processing.
       
   487             largeImageQuery = ETrue;
       
   488             }
       
   489         }
       
   490     else
       
   491         {
       
   492         // Image will be processed
       
   493         if ( scaleSize.iWidth > conformanceWidth ||
       
   494              scaleSize.iHeight > conformanceHeight )
       
   495             {
       
   496             // Processed image is "non-conformant" after processing.
       
   497             largeImageQuery = ETrue;
       
   498             }
       
   499         }
       
   500 
       
   501     if ( largeImageQuery &&  iDocument.CreationMode() == EMmsCreationModeWarning )
       
   502         {
       
   503         // Observer will make the final decision whether it will show the query or not.
       
   504         if ( !iObserver.EditorOperationQuery( EUniEditorOperationProcessImage,
       
   505                                               EMEOQueryGuidedInsertLarge ) )
       
   506             {
       
   507             SetError( EUniProcessImgUserAbort );
       
   508             return EFalse; // Abort
       
   509             }
       
   510         }
       
   511         
       
   512     iScaleSize = scaleSize;
       
   513     return ETrue;
       
   514     }
       
   515 
       
   516 // ---------------------------------------------------------
       
   517 // CUniEditorProcessImageOperation::CreateEmptyAttachmentL
       
   518 // ---------------------------------------------------------
       
   519 //
       
   520 void CUniEditorProcessImageOperation::CreateEmptyAttachmentL()
       
   521     {
       
   522     iNewAttaId = KMsvNullIndexEntryId;
       
   523 
       
   524     // Get the file name from original full path name.
       
   525     TParsePtrC parser( iImageInfo->FullFilePath() );
       
   526 
       
   527     TFileName ext( parser.Ext() );
       
   528     iTargetType = iImageInfo->MimeType();
       
   529 
       
   530     if ( iTargetType.Des8().CompareF( KMsgMimeImagePng ) == 0 )
       
   531         {
       
   532         //png is non-conformant image type
       
   533         //->convert to jpeg
       
   534         iTargetType = TDataType( KMsgMimeImageJpeg );
       
   535         ext.Zero();
       
   536         ext.Copy( KUniExtImageJpeg_8 );
       
   537         }
       
   538     else if ( iTargetType.Des8().CompareF( KMsgMimeImageWbmp ) == 0 )
       
   539         {
       
   540         //no wbmp encoder
       
   541         //->convert to gif if scaling is needed
       
   542         iTargetType = TDataType( KMsgMimeImageGif );
       
   543         ext.Zero();
       
   544         ext.Copy( KUniExtImageGif_8 );
       
   545         }
       
   546 
       
   547     TFileName newFileName( parser.Name() );
       
   548     newFileName.Append( ext );
       
   549 
       
   550     iEditStore = iDocument.Mtm().Entry().EditStoreL();
       
   551     MMsvAttachmentManagerSync& managerSync = iEditStore->AttachmentManagerExtensionsL();
       
   552     CMsvAttachment* attachment = CMsvAttachment::NewL( CMsvAttachment::EMsvFile );
       
   553     CleanupStack::PushL( attachment );
       
   554     
       
   555     attachment->SetMimeTypeL( iTargetType.Des8() );
       
   556 
       
   557     managerSync.CreateAttachmentL( newFileName, iNewImageFile, attachment );
       
   558     CleanupStack::Pop( attachment ); // ownership transferred
       
   559     
       
   560     iNewAttaId = attachment->Id();
       
   561     }
       
   562 
       
   563 // ---------------------------------------------------------
       
   564 // CUniEditorProcessImageOperation::ImageSendSize
       
   565 // ---------------------------------------------------------
       
   566 //
       
   567 TSize CUniEditorProcessImageOperation::ImageSendSize() const
       
   568     {
       
   569     TSize size;
       
   570     if( TUniMsvEntry::IsMmsUpload( iDocument.Entry() ) )
       
   571         {
       
   572         size.iWidth = KUniMmsUploadImageWidth;
       
   573         size.iHeight = KUniMmsUploadImageHeight;
       
   574         }
       
   575     else
       
   576         {
       
   577         size =  iDocument.MaxImageSize();
       
   578         }
       
   579     return size;
       
   580     }
       
   581 
       
   582 // ---------------------------------------------------------
       
   583 // CUniEditorProcessImageOperation::OpenFileForReadingL
       
   584 // ---------------------------------------------------------
       
   585 //
       
   586 RFile CUniEditorProcessImageOperation::OpenFileForReadingL()
       
   587     {
       
   588     RFile sourceFile;
       
   589     if ( iAttachmentId != KMsvNullIndexEntryId )
       
   590         {
       
   591         __ASSERT_DEBUG( iEditStore, Panic( EUniNullPointer ) );
       
   592         sourceFile = iEditStore->AttachmentManagerL().GetAttachmentFileL( iAttachmentId );
       
   593         }
       
   594     else
       
   595         {
       
   596         TInt err = sourceFile.Open(
       
   597             iFs, iImageInfo->FullFilePath(), EFileRead | EFileShareAny );
       
   598         if ( err )
       
   599             {
       
   600             err = sourceFile.Open(
       
   601                 iFs, iImageInfo->FullFilePath(), EFileRead | EFileShareReadersOnly );
       
   602                 
       
   603             User::LeaveIfError( err );
       
   604             }
       
   605         }
       
   606     return sourceFile;
       
   607     }
       
   608     
       
   609 // ---------------------------------------------------------
       
   610 // CUniEditorProcessImageOperation::RunError
       
   611 // ---------------------------------------------------------
       
   612 //
       
   613 TInt CUniEditorProcessImageOperation::RunError( TInt aError )
       
   614     {
       
   615     delete iImageProcessor;
       
   616     iImageProcessor = NULL;
       
   617     
       
   618     if ( aError == KErrNotFound )
       
   619         {
       
   620         aError = EUniProcessImgNotFound;
       
   621         }
       
   622     else if ( aError == KErrNoMemory )
       
   623         {
       
   624         aError = EUniProcessImgOutOfMemory;
       
   625         }
       
   626     else if ( aError == KErrDiskFull )
       
   627         {
       
   628         aError = EUniProcessImgOutOfDisk;
       
   629         }
       
   630     else if ( aError == KErrCorrupt )
       
   631         {
       
   632         aError = EUniProcessImgCorrupted;
       
   633         }
       
   634         
       
   635     return CUniEditorOperation::RunError( aError );
       
   636     }
       
   637     
       
   638 // ---------------------------------------------------------
       
   639 // CUniEditorProcessImageOperation::DetachImageInfo
       
   640 // ---------------------------------------------------------
       
   641 //
       
   642 CMsgImageInfo* CUniEditorProcessImageOperation::DetachImageInfo()
       
   643     {
       
   644     // ownership transferred
       
   645     CMsgImageInfo* tempInfo = iNewImageInfo;
       
   646     iNewImageInfo = NULL;
       
   647     return tempInfo;
       
   648     }
       
   649     
       
   650 // End of file