messagingapp/msgui/unifiededitor/src/msgunieditorprocessimageoperation.cpp
changeset 34 84197e66a4bd
parent 31 ebfee66fde93
child 44 36f374c67aa8
equal deleted inserted replaced
31:ebfee66fde93 34:84197e66a4bd
    17 
    17 
    18 
    18 
    19 
    19 
    20 // ========== INCLUDE FILES ================================
    20 // ========== INCLUDE FILES ================================
    21 
    21 
    22 #include <BASCHED.H>
    22 #include <basched.h>
    23 #include <icl/imagedata.h>
    23 #include <icl/imagedata.h>
    24 
    24 
    25 #include <centralrepository.h>
    25 #include <centralrepository.h>
    26 
    26 
    27 #include <messagingvariant.hrh>
    27 #include <MessagingVariant.hrh>
    28 #include <messaginginternalcrkeys.h> // for Central Repository keys
    28 #include <MessagingInternalCRKeys.h> // for Central Repository keys
    29 
    29 
    30 #include <MsgMediaResolver.h>
    30 #include <MsgMediaResolver.h>
    31 #include <MsgImageInfo.h>
    31 #include <MsgImageInfo.h>
    32 #include <MmsConformance.h>
    32 #include <MmsConformance.h>
    33 #include <MsgMimeTypes.h>
    33 #include <MsgMimeTypes.h>
    41 
    41 
    42 #include <msgtextutils.h>
    42 #include <msgtextutils.h>
    43 
    43 
    44 #include <msvids.h>
    44 #include <msvids.h>
    45 #include <MmsEngineDomainCRKeys.h>
    45 #include <MmsEngineDomainCRKeys.h>
    46 #include <mmssettingsdefs.h>
    46 #include <msgunieditormmssettingsdefs.h>
    47 #include <HbMessageBox>
    47 #include <HbMessageBox>
    48 #include <HbAction>
    48 #include <HbAction>
    49 #include <mmsconst.h>
    49 #include <mmsconst.h>
    50 
    50 
    51 #include "msgmonitor.h"
    51 #include "msgunieditormonitor.h"
    52 #include "msgunieditorprocessimageoperation.h"
    52 #include "msgunieditorprocessimageoperation.h"
    53 
    53 
    54 // ========== CONSTANTS ====================================
    54 // ========== CONSTANTS ====================================
    55 
    55 
    56 // Leave some space after compression so that text can be inserted to the 
    56 // Leave some space after compression so that text can be inserted to the 
    83     CUniEditorProcessImageOperation* self = new ( ELeave ) 
    83     CUniEditorProcessImageOperation* self = new ( ELeave ) 
    84                     CUniEditorProcessImageOperation(aObserver);
    84                     CUniEditorProcessImageOperation(aObserver);
    85             
    85             
    86     CleanupStack::PushL( self );
    86     CleanupStack::PushL( self );
    87     self->ConstructL();
    87     self->ConstructL();
    88     CleanupStack::Pop( self );
    88     CleanupStack::Pop();
    89     
    89     
    90     return self;
    90     return self;
    91     }
    91     }
    92 
    92 
    93 // ---------------------------------------------------------
    93 // ---------------------------------------------------------
   147         iMmsCreationMode = temp;
   147         iMmsCreationMode = temp;
   148     }
   148     }
   149     
   149     
   150     delete repository;
   150     delete repository;
   151 
   151 
   152     iMaxMmsSize = MsgMonitor::maxMmsSize();
   152     iMaxMmsSize = MsgUnifiedEditorMonitor::maxMmsSize();
   153     }
   153     }
   154 
   154 
   155 // ---------------------------------------------------------
   155 // ---------------------------------------------------------
   156 // CUniEditorProcessImageOperation::~CUniEditorProcessImageOperation
   156 // CUniEditorProcessImageOperation::~CUniEditorProcessImageOperation
   157 // ---------------------------------------------------------
   157 // ---------------------------------------------------------
   474             }
   474             }
   475         }
   475         }
   476 
   476 
   477     if ( !( iProcessMethod & EUniProcessImgMethodScale ) &&
   477     if ( !( iProcessMethod & EUniProcessImgMethodScale ) &&
   478          ( iImageInfo->FileSize() + 
   478          ( iImageInfo->FileSize() + 
   479            MsgMonitor::messageSize() ) > iMaxMmsSize &&
   479            MsgUnifiedEditorMonitor::messageSize() ) > iMaxMmsSize &&
   480          iImageInfo->MimeType().CompareF( KMsgMimeImageJpeg ) == 0 &&
   480          iImageInfo->MimeType().CompareF( KMsgMimeImageJpeg ) == 0 &&
   481          (MsgMonitor::messageSize()) < KUniCompressionMargin )
   481          (MsgUnifiedEditorMonitor::messageSize()) < KUniCompressionMargin )
   482         {
   482         {
   483         // Only compression needed as image is JPEG that is larger than can be fitted
   483         // Only compression needed as image is JPEG that is larger than can be fitted
   484         // into the message and scaling is not performed. Also current message size
   484         // into the message and scaling is not performed. Also current message size
   485         // is under comression margin.
   485         // is under comression margin.
   486         iProcessMethod |= EUniProcessImgMethodCompress;
   486         iProcessMethod |= EUniProcessImgMethodCompress;
   491     if ( iProcessMethod == EUniProcessImgMethodNone )
   491     if ( iProcessMethod == EUniProcessImgMethodNone )
   492         {
   492         {
   493         // Image won't be processed
   493         // Image won't be processed
   494         if ( ( origSize.iWidth > KImageRichWidth ||
   494         if ( ( origSize.iWidth > KImageRichWidth ||
   495                origSize.iHeight > KImageRichHeight ) &&
   495                origSize.iHeight > KImageRichHeight ) &&
   496              ( iImageInfo->FileSize() + MsgMonitor::messageSize() ) < iMaxMmsSize )
   496              ( iImageInfo->FileSize() + MsgUnifiedEditorMonitor::messageSize() ) < iMaxMmsSize )
   497             {
   497             {
   498             // Original image width or height is "non-conformant" and original image would 
   498             // Original image width or height is "non-conformant" and original image would 
   499             // fit to into the message without any processing.
   499             // fit to into the message without any processing.
   500             largeImageQuery = ETrue;
   500             largeImageQuery = ETrue;
   501             }
   501             }