mobilemessaging/unieditor/application/src/UniEditorLaunchOperation.cpp
branchRCL_3
changeset 27 7fdbb852d323
child 28 fc3320e39880
equal deleted inserted replaced
26:ebe688cedc25 27:7fdbb852d323
       
     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:   CUniEditorLaunchOperation
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 // ========== INCLUDE FILES ================================
       
    21 
       
    22 #include <AknsConstants.h>
       
    23 #include <data_caging_path_literals.hrh> 
       
    24 #include <aknlayoutscalable_apps.cdl.h>
       
    25 
       
    26 // Features
       
    27 #include <featmgr.h>    
       
    28 #include <bldvariant.hrh>
       
    29 #include <centralrepository.h>    // link against centralrepository.lib
       
    30 #include <messaginginternalcrkeys.h> // for Central Repository keys
       
    31 
       
    32 #include <mmsconst.h>
       
    33 
       
    34 #include <MsgEditorView.h>          // for CMsgEditorView
       
    35 #include <MsgEditorAppUi.h>
       
    36 #include <MsgEditorCommon.h>
       
    37 #include <msgimagecontrol.h>
       
    38 #include <MuiuMsgEditorLauncher.h>
       
    39 
       
    40 #include <msgasynccontrolobserver.h>
       
    41 
       
    42 #include <uniutils.mbg>
       
    43 #include <UniEditor.rsg>
       
    44 
       
    45 #include "UniPluginApi.h"
       
    46 #include "UniSendingSettings.h"
       
    47 #include <unidatamodel.h>
       
    48 #include <unismilmodel.h>
       
    49 #include <unislideloader.h>
       
    50 #include <unimsventry.h>
       
    51 
       
    52 #include "UniEditorDocument.h"
       
    53 #include "UniEditorHeader.h"
       
    54 #include "UniEditorLaunchOperation.h"
       
    55 
       
    56 _LIT( KUniEditorMbmFile, "uniutils.mbm" );
       
    57 
       
    58 // ========== EXTERNAL DATA STRUCTURES =====================
       
    59 
       
    60 // ========== EXTERNAL FUNCTION PROTOTYPES =================
       
    61 
       
    62 // ========== CONSTANTS ====================================
       
    63 
       
    64 const TInt  KMaxSubjectLength = 40;   // From MMS Conformance Document
       
    65 
       
    66 // ========== MACROS =======================================
       
    67 
       
    68 // ========== LOCAL CONSTANTS AND MACROS ===================
       
    69 
       
    70 // ========== MODULE DATA STRUCTURES =======================
       
    71 
       
    72 // ========== LOCAL FUNCTION PROTOTYPES ====================
       
    73 
       
    74 // ========== LOCAL FUNCTIONS ==============================
       
    75 
       
    76 // ========== MEMBER FUNCTIONS =============================
       
    77 
       
    78 // ---------------------------------------------------------
       
    79 // CUniEditorLaunchOperation::NewL
       
    80 //
       
    81 // Factory method.
       
    82 // ---------------------------------------------------------
       
    83 //
       
    84 CUniEditorLaunchOperation* CUniEditorLaunchOperation::NewL(
       
    85         MMsgAsyncControlObserver& aControlObserver,
       
    86         MUniEditorOperationObserver& aOperationObserver,
       
    87         CUniEditorDocument& aDocument,
       
    88         CMsgEditorView& aView,
       
    89         CMsgEditorAppUi& aAppUi,
       
    90         RFs& aFs )
       
    91     {
       
    92     CUniEditorLaunchOperation* self = 
       
    93         new ( ELeave ) CUniEditorLaunchOperation( aControlObserver, aOperationObserver, aDocument, aView, aAppUi, aFs );
       
    94         
       
    95     CleanupStack::PushL( self );
       
    96     self->ConstructL();
       
    97     CleanupStack::Pop( self );
       
    98     
       
    99     return self;
       
   100     }
       
   101 
       
   102 // ---------------------------------------------------------
       
   103 // CUniEditorLaunchOperation::CUniEditorLaunchOperation
       
   104 //
       
   105 // Constructor.
       
   106 // ---------------------------------------------------------
       
   107 //
       
   108 CUniEditorLaunchOperation::CUniEditorLaunchOperation(
       
   109         MMsgAsyncControlObserver& aControlObserver,
       
   110         MUniEditorOperationObserver& aOperationObserver,
       
   111         CUniEditorDocument& aDocument,
       
   112         CMsgEditorView& aView,
       
   113         CMsgEditorAppUi& aAppUi,
       
   114         RFs& aFs ) :
       
   115     CUniEditorOperation( aOperationObserver, aDocument, aFs, EUniEditorOperationLaunch ),
       
   116     iControlObserver( aControlObserver ),
       
   117     iView( aView ),
       
   118     iAppUi( aAppUi ),
       
   119     iOptimizedFlow(EFalse)
       
   120     {
       
   121     }
       
   122 
       
   123 // ---------------------------------------------------------
       
   124 // CUniEditorLaunchOperation::ConstructL
       
   125 //
       
   126 // 2nd phase constructor.
       
   127 // ---------------------------------------------------------
       
   128 //
       
   129 void CUniEditorLaunchOperation::ConstructL()
       
   130     {
       
   131     BaseConstructL();
       
   132     FeatureManager::InitializeLibL();
       
   133     iSmilEditorSupported = FeatureManager::FeatureSupported( KFeatureIdSmilEditor );
       
   134     FeatureManager::UnInitializeLib();    
       
   135     }
       
   136 
       
   137 // ---------------------------------------------------------
       
   138 // CUniEditorLaunchOperation::CUniEditorLaunchOperation
       
   139 //
       
   140 // Destructor.
       
   141 // ---------------------------------------------------------
       
   142 //
       
   143 CUniEditorLaunchOperation::~CUniEditorLaunchOperation()
       
   144     {
       
   145     Cancel();
       
   146     delete iSendUiOperation;
       
   147     delete iHeader;
       
   148     delete iSlideLoader;
       
   149 
       
   150 #ifdef RD_MSG_XHTML_SUPPORT 
       
   151     delete iTextOperation;
       
   152 #endif
       
   153     }
       
   154 
       
   155 // ---------------------------------------------------------
       
   156 // CUniEditorLaunchOperation::Launch
       
   157 // ---------------------------------------------------------
       
   158 //
       
   159 void CUniEditorLaunchOperation::Launch()
       
   160     {
       
   161     iParseResultTemp= 0;
       
   162     ResetErrors();
       
   163     iOperationState = EUniLaunchInitializeDoc;
       
   164     CompleteSelf( KErrNone );
       
   165     }
       
   166 
       
   167 // ---------------------------------------------------------
       
   168 // CUniEditorLaunchOperation::DoLaunchStepL
       
   169 // ---------------------------------------------------------
       
   170 //
       
   171 void CUniEditorLaunchOperation::DoLaunchStepL()
       
   172     {
       
   173     switch ( iOperationState )
       
   174         {
       
   175         case EUniLaunchInitializeDoc:
       
   176             {
       
   177             DoInitializeDocL();
       
   178             break;
       
   179             }
       
   180         case EUniLaunchInitializeModel:
       
   181             {
       
   182             DoInitializeModelL();
       
   183             break;
       
   184             }
       
   185         case EUniLaunchHandleMessage:
       
   186             {
       
   187             DoHandleMessageL();
       
   188             break;
       
   189             }
       
   190         case EUniLaunchPrepareHeader:
       
   191             {
       
   192             DoPrepareHeaderL();
       
   193             break;
       
   194             }
       
   195         case EUniLaunchPrepareBody:
       
   196             {
       
   197             DoPrepareBodyL();
       
   198             break;
       
   199             }
       
   200         case EUniLaunchEnd:
       
   201             {
       
   202             iObserver.EditorOperationEvent(
       
   203                 EUniEditorOperationLaunch,
       
   204                 EUniEditorOperationComplete ); 
       
   205             break;
       
   206             }
       
   207         default:
       
   208             iObserver.EditorOperationEvent(
       
   209                 EUniEditorOperationLaunch,
       
   210                 EUniEditorOperationError ); 
       
   211             break;
       
   212         }
       
   213 
       
   214     iOperationState++;
       
   215     }
       
   216 
       
   217 // ---------------------------------------------------------
       
   218 // CUniEditorLaunchOperation::DoInitializeDocL
       
   219 // ---------------------------------------------------------
       
   220 //
       
   221 void CUniEditorLaunchOperation::DoInitializeDocL()
       
   222     {
       
   223     TUniMessageCharSetSupport charSet = EUniMessageCharSetFull;
       
   224 
       
   225     iDocument.LaunchPlugings();
       
   226 
       
   227     CMsvStore* readStore = NULL;
       
   228     if ( iDocument.Mtm().Entry().HasStoreL() )
       
   229     	{
       
   230         readStore = iDocument.Mtm().Entry().ReadStoreL();
       
   231     	}
       
   232     CleanupStack::PushL( readStore );
       
   233 
       
   234     if( iDocument.SmsPlugin() )
       
   235         {
       
   236         iDocument.SmsPlugin()->LoadHeadersL( readStore );
       
   237 
       
   238         // Check the valid charsupport setting
       
   239         if( iDocument.MessageType() == EUniOpenFromDraft )
       
   240             {
       
   241             charSet = TUniMsvEntry::CharSetSupport( iDocument.Mtm().Entry().Entry() );
       
   242             }
       
   243         else
       
   244             {
       
   245             TInt features = 0;
       
   246             CRepository* storage = CRepository::NewLC( KCRUidSmum );
       
   247             
       
   248             if ( storage->Get( KSmumCharSupport, features ) == KErrNone )
       
   249                 {
       
   250                 if( features == EUniMessageCharSetReduced )
       
   251                     {
       
   252                     charSet = EUniMessageCharSetReduced;
       
   253                     }
       
   254                 else if( features == EUniMessageCharSetFullLocked )
       
   255                     {
       
   256                     charSet = EUniMessageCharSetFullLocked;
       
   257                     }
       
   258                 else if( features == EUniMessageCharSetReducedLocked )
       
   259                     {
       
   260                     charSet = EUniMessageCharSetReducedLocked;
       
   261                     }
       
   262                 else
       
   263                     {
       
   264                     charSet = EUniMessageCharSetFull;
       
   265                     }
       
   266                 }    
       
   267                 
       
   268             CleanupStack::PopAndDestroy( storage );
       
   269             }
       
   270         }
       
   271         
       
   272     if( iDocument.MmsPlugin() )
       
   273         {
       
   274       	iDocument.MmsPlugin()->LoadHeadersL( readStore );
       
   275         }
       
   276         
       
   277     CleanupStack::PopAndDestroy( readStore );
       
   278 
       
   279     iDocument.CreateCharConverterL( charSet );
       
   280 
       
   281     CompleteSelf( KErrNone );
       
   282     }
       
   283 
       
   284 // ---------------------------------------------------------
       
   285 // CUniEditorLaunchOperation::DoInitializeModelL
       
   286 // ---------------------------------------------------------
       
   287 //
       
   288 void CUniEditorLaunchOperation::DoInitializeModelL()
       
   289     {
       
   290     iDocument.DataModel()->RestoreL( *this );
       
   291     SetPending();
       
   292     }
       
   293 
       
   294 // ---------------------------------------------------------
       
   295 // CUniEditorLaunchOperation::RestoreReady
       
   296 //
       
   297 // RestoreReady: a callback from RestoreL
       
   298 // ---------------------------------------------------------
       
   299 //
       
   300 void CUniEditorLaunchOperation::RestoreReady( TInt /*aParseResult*/, TInt aError )
       
   301     {
       
   302     CompleteOperation( aError );
       
   303     }
       
   304 
       
   305 // ---------------------------------------------------------
       
   306 // CUniEditorLaunchOperation::DoHandleMessageL
       
   307 // ---------------------------------------------------------
       
   308 //
       
   309 void CUniEditorLaunchOperation::DoHandleMessageL()
       
   310     {
       
   311     // Synchronize uniobjects that are not yet parsed
       
   312     iDocument.DataModel()->FinalizeMediaParse();
       
   313     
       
   314     // Map NoSmil and MultipleSmil to MmsSmil
       
   315     if ( iDocument.DataModel()->SmilType() == ENoSmil ||
       
   316          iDocument.DataModel()->SmilType() == EMultipleSmil )
       
   317         {
       
   318         iDocument.DataModel()->SetSmilType( EMmsSmil );
       
   319         }
       
   320     
       
   321     if ( iDocument.Mtm().Body().DocumentLength() > 0 )
       
   322         {
       
   323         // When UniEditor message is formed from real SMS message the body text 
       
   324         // is not saved to text attachment but copied directly to text control. 
       
   325         // Setting the body modified will trigger the saving to be done.
       
   326         iDocument.SetBodyModified( ETrue );
       
   327         }
       
   328     
       
   329     switch ( iDocument.MessageType() )    
       
   330         {
       
   331         case EUniNewMessage:
       
   332             {
       
   333             //no operation
       
   334             break;
       
   335             }
       
   336         case EUniReply:
       
   337             {
       
   338             AddSubjectPrefixL( ETrue );
       
   339             iDocument.SetHeaderModified( ETrue );  // To get "Save message..." query always
       
   340             break;
       
   341             }
       
   342         case EUniForward:
       
   343             {
       
   344             // Code runs here when message is forwarded and forwarded message
       
   345             // has been saved into Drafts.
       
   346             // iDocument.LaunchFlags() & EMsgForwardMessage is ETrue, only when
       
   347             // message is being forwarded from Viewer
       
   348             if ( ( iDocument.LaunchFlags() & EMsgForwardMessage ) &&
       
   349                    !TUniMsvEntry::IsMmsUpload( iDocument.Entry() ) )
       
   350                 {
       
   351                 AddSubjectPrefixL( EFalse );
       
   352                 }
       
   353                         
       
   354             // If Subject variation is Off, subject has been shown in the viewer
       
   355             // but will not be shown and saved in the editor
       
   356             iDocument.SetHeaderModified( ETrue );  // To get "Save message..." query always
       
   357             
       
   358 #ifdef RD_MSG_XHTML_SUPPORT 
       
   359             iTextOperation = CUniEditorProcessTextOperation::NewL( *this, iDocument, iFs );
       
   360             iTextOperation->Start();
       
   361             
       
   362             SetPending();
       
   363             return;
       
   364 #else
       
   365             break;
       
   366 #endif
       
   367             }
       
   368         case EUniOpenFromDraft:
       
   369             {
       
   370             //no operation
       
   371             // Added, because of additional header feature.
       
   372             // Variation has changed On->Off and message opened from Drafts
       
   373             // To get "Save message..." query always
       
   374             iDocument.SetHeaderModified( ETrue );
       
   375             break;
       
   376             }
       
   377         case EUniSendUi:
       
   378             {
       
   379             // NOTE: Write from phoneidle is handled as SendAs
       
   380             iDocument.SetHeaderModified( ETrue ); // To get "Save message..." note always
       
   381             
       
   382             
       
   383             iSendUiOperation = CUniEditorSendUiOperation::NewL( *this, iDocument, iFs );
       
   384             iSendUiOperation->Start();
       
   385             
       
   386             SetPending();
       
   387             return;
       
   388             }
       
   389         default:
       
   390             {
       
   391             // Message type not known
       
   392             User::Leave( KErrNotSupported );
       
   393             break;
       
   394             }
       
   395         }
       
   396     CompleteSelf( KErrNone );
       
   397     }
       
   398 
       
   399 // ---------------------------------------------------------
       
   400 // CUniEditorLaunchOperation::DoPrepareHeaderL
       
   401 // ---------------------------------------------------------
       
   402 //
       
   403 void CUniEditorLaunchOperation::DoPrepareHeaderL()
       
   404     {
       
   405     if(!iHeader)
       
   406         {
       
   407 	    // Header is always drawn and populated
       
   408 	    iHeader = CUniEditorHeader::NewL( iDocument.Mtm(), iDocument, iView, iFs );
       
   409         }
       
   410     if(!iOptimizedFlow)
       
   411         CompleteSelf( KErrNone );
       
   412     }
       
   413 
       
   414 // ---------------------------------------------------------
       
   415 // CUniEditorLaunchOperation::DoPrepareBodyL
       
   416 // ---------------------------------------------------------
       
   417 //
       
   418 void CUniEditorLaunchOperation::DoPrepareBodyL()
       
   419     {
       
   420     if(!iSlideLoader)
       
   421         {
       
   422      	iSlideLoader = CUniSlideLoader::NewL(
       
   423 	        iControlObserver,
       
   424 	        *iDocument.DataModel(),
       
   425 	        iView,
       
   426 	        EUniControlEditorMode );
       
   427         }
       
   428     
       
   429     if ( iDocument.DataModel()->SmilType() == EMmsSmil )
       
   430         {
       
   431         if(!iOptimizedFlow)
       
   432             {
       
   433 	        if ( !iDocument.DataModel()->SmilModel().SlideCount() )
       
   434 	            {
       
   435 	            iDocument.DataModel()->SmilModel().AddSlideL();
       
   436 	            }
       
   437             
       
   438 	        iSlideLoader->LoadSlideL( *this, 0 );       
       
   439         
       
   440 	        SetPending();
       
   441             }
       
   442         }
       
   443     else
       
   444         {
       
   445         // All unsupported files should be in
       
   446         // attachment list! 
       
   447         //
       
   448         // We should get here only if the SMIL is
       
   449         // more complex than MMS SMIL.
       
   450         //
       
   451         switch ( iDocument.CreationMode() )
       
   452             {
       
   453             case EMmsCreationModeRestricted:
       
   454                 {
       
   455                 // Other than MMS SMIL not supported in restricted mode
       
   456                 SetError( KUniLaunchAbortPresRestricted );
       
   457                 CompleteSelf( KErrNone );
       
   458                 return;
       
   459                 }
       
   460             case EMmsCreationModeWarning:
       
   461                 {
       
   462                 // Should be handled in editor side.
       
   463                 SetError( KUniLaunchPresGuided );
       
   464                 }
       
   465                 // FALLTHROUGH
       
   466             case EMmsCreationModeFree:
       
   467             default:
       
   468                 {
       
   469                 if( TUniMsvEntry::IsForwardedMessage( iDocument.Entry() ) || 
       
   470                     !iSmilEditorSupported )
       
   471                     {
       
   472                     // No editing allowed for forwarded "TemplateSmil"
       
   473                     // "TemplateSmil" not supported in restricted mode
       
   474                     // "TemplateSmil" not supported if SmilEditor disabled
       
   475                     //
       
   476                     // Set SMIL type to "3GPPSmil"
       
   477                     iDocument.DataModel()->SetSmilType( E3GPPSmil );
       
   478                     }
       
   479                 break;
       
   480                 }
       
   481             }
       
   482             
       
   483         DoPrepare3GPPBodyL();
       
   484         CompleteSelf( KErrNone );
       
   485         }
       
   486     }
       
   487 
       
   488 // ---------------------------------------------------------
       
   489 // CUniEditorLaunchOperation::DoPrepare3GPPBodyL
       
   490 // ---------------------------------------------------------
       
   491 //
       
   492 void CUniEditorLaunchOperation::DoPrepare3GPPBodyL()
       
   493     {
       
   494     CMsgImageControl* imageControl = CMsgImageControl::NewL( iView,
       
   495                                                              &iControlObserver );
       
   496     CleanupStack::PushL( imageControl );
       
   497     
       
   498     imageControl->SetControlId( EMsgComponentIdImage );
       
   499     
       
   500     TAknsItemID id = KAknsIIDQgnGrafMmsUnedit;
       
   501     TInt icon = EMbmUniutilsQgn_graf_mms_unedit;
       
   502     TInt mask = EMbmUniutilsQgn_graf_mms_unedit_mask;
       
   503 
       
   504     if ( iDocument.DataModel()->SmilType() == ETemplateSmil )
       
   505         {
       
   506         id.Set( KAknsIIDQgnGrafMmsEdit );
       
   507         icon = EMbmUniutilsQgn_graf_mms_edit;
       
   508         mask = EMbmUniutilsQgn_graf_mms_edit_mask;
       
   509         }
       
   510 
       
   511     TParse fileParse;
       
   512     fileParse.Set( KUniEditorMbmFile, &KDC_APP_BITMAP_DIR, NULL );
       
   513     imageControl->LoadIconL( fileParse.FullName(), id, icon, mask );
       
   514     
       
   515     TAknLayoutRect iconLayout;
       
   516     iconLayout.LayoutRect( MsgEditorCommons::MsgDataPane(),
       
   517                            AknLayoutScalable_Apps::msg_data_pane_g4().LayoutLine() );
       
   518     
       
   519     imageControl->SetIconSizeL( iconLayout.Rect().Size() );
       
   520     imageControl->SetIconVisible( ETrue );
       
   521     
       
   522     //The ownership of imageControl is transferred to iView
       
   523     iView.AddControlL( imageControl, EMsgComponentIdImage, EMsgFirstControl, EMsgBody );
       
   524     CleanupStack::Pop( imageControl );
       
   525     }
       
   526 
       
   527 // ---------------------------------------------------------
       
   528 // CUniEditorLaunchOperation::AddSubjectPrefixL
       
   529 // ---------------------------------------------------------
       
   530 //
       
   531 void CUniEditorLaunchOperation::AddSubjectPrefixL( TBool aReply )
       
   532     {
       
   533     HBufC* newSubject = NULL;
       
   534     
       
   535     if( iDocument.Mtm().SubjectL().Length() > 0 )
       
   536         { 
       
   537         // Add prefix only if there's some content in subject field
       
   538         newSubject = iAppUi.CreateSubjectPrefixStringL( iDocument.Mtm().SubjectL(),
       
   539                                                         aReply );
       
   540         }
       
   541     
       
   542     if ( newSubject )
       
   543         {
       
   544         CleanupStack::PushL( newSubject );
       
   545         iDocument.Mtm().SetSubjectL( newSubject->Left( KMaxSubjectLength ) );
       
   546         iDocument.SetHeaderModified( ETrue );  // To get "Save message..." query always
       
   547         CleanupStack::PopAndDestroy( newSubject );
       
   548         }
       
   549     }
       
   550 
       
   551 // ---------------------------------------------------------
       
   552 // CUniEditorLaunchOperation::DoCancelCleanup
       
   553 // ---------------------------------------------------------
       
   554 //
       
   555 void CUniEditorLaunchOperation::DoCancelCleanup()
       
   556     {
       
   557     if ( iSlideLoader )
       
   558         {
       
   559         iSlideLoader->Cancel();
       
   560         }
       
   561         
       
   562     if ( iSendUiOperation )
       
   563         {
       
   564         iSendUiOperation->Cancel();
       
   565         }
       
   566 
       
   567 #ifdef RD_MSG_XHTML_SUPPORT 
       
   568     if ( iTextOperation )
       
   569         {
       
   570         iTextOperation->Cancel();
       
   571         }
       
   572 #endif
       
   573     }
       
   574 
       
   575 // ---------------------------------------------------------
       
   576 // CUniEditorLaunchOperation::RunL
       
   577 // ---------------------------------------------------------
       
   578 //
       
   579 void CUniEditorLaunchOperation::RunL()
       
   580     {
       
   581     PrintOperationAndState();
       
   582     if ( iStatus.Int() != KErrNone )
       
   583         {
       
   584         // if EUniEditorExit, next error code is reason to exit
       
   585         SetError( EUniEditorExit );
       
   586         SetErrorAndReport( iStatus.Int() );
       
   587         }
       
   588     else
       
   589         {
       
   590         DoLaunchStepL();
       
   591         }
       
   592     }
       
   593 
       
   594 // ---------------------------------------------------------
       
   595 // CUniEditorLaunchOperation::RunError
       
   596 // ---------------------------------------------------------
       
   597 //
       
   598 TInt CUniEditorLaunchOperation::RunError( TInt aError )
       
   599     {
       
   600     // If EUniEditorExit, next error code is reason to exit
       
   601     SetError( EUniEditorExit );
       
   602     SetError( aError );
       
   603     
       
   604     iObserver.EditorOperationEvent( EUniEditorOperationLaunch,
       
   605                                     EUniEditorOperationError );
       
   606     return KErrNone;
       
   607     }
       
   608 
       
   609 // ---------------------------------------------------------
       
   610 // CUniEditorLaunchOperation::SlideLoadReady
       
   611 // ---------------------------------------------------------
       
   612 //
       
   613 void CUniEditorLaunchOperation::SlideLoadReady( TInt aError )
       
   614     {
       
   615     CompleteOperation( aError );
       
   616     }
       
   617 
       
   618 // ---------------------------------------------------------
       
   619 // CUniEditorLaunchOperation::HandleOperationEvent
       
   620 // ---------------------------------------------------------
       
   621 //
       
   622 void CUniEditorLaunchOperation::HandleOperationEvent( TUniEditorOperationType aOperation,
       
   623                                                       TUniEditorOperationEvent aEvent )
       
   624     {
       
   625     if ( aOperation == EUniEditorOperationSendUi )
       
   626         {
       
   627         iOptimizedFlow = EFalse;
       
   628         if(aEvent == EUniEditorOperationPartialComplete)
       
   629             {
       
   630             iOptimizedFlow = iSendUiOperation->IsOptimizedFlagSet();
       
   631             if(iOptimizedFlow)
       
   632                 {
       
   633                 DoPrepareHeaderL();
       
   634                 DoPrepareBodyL();
       
   635                 iObserver.EditorOperationEvent(
       
   636                             EUniEditorOperationLaunch,
       
   637                             EUniEditorOperationComplete ); 
       
   638                 iOptimizedFlow = EFalse;
       
   639                 }
       
   640             return;
       
   641             }
       
   642         CArrayFixFlat<TInt>* errors = iSendUiOperation->GetErrors();
       
   643         for ( TInt i = 0; i < errors->Count(); i++ )
       
   644             {
       
   645             if ( errors->At( i ) == EUniProcessImgUserAbort )
       
   646                 {
       
   647                 iOperationState = EUniLaunchEnd;
       
   648                 }
       
   649             else if ( errors->At( i ) == EUniProcessImgCouldNotScale &&
       
   650                       iDocument.CreationMode() != EMmsCreationModeRestricted )
       
   651                 {
       
   652                 // This occurs when animated or transparent gif. Other cases?
       
   653                 // Gif type is by default conformant
       
   654                 iParseResultTemp++;
       
   655                 }
       
   656             SetError( errors->At( i ) );
       
   657             }
       
   658         }
       
   659 #ifdef RD_MSG_XHTML_SUPPORT 
       
   660     else
       
   661         {
       
   662         CArrayFixFlat<TInt>* errors = iTextOperation->GetErrors();
       
   663         for ( TInt i = 0; i < errors->Count(); i++ )
       
   664             {
       
   665             SetError( errors->At( i ) );
       
   666             }
       
   667         }
       
   668 #endif
       
   669 
       
   670     CompleteOperation( KErrNone );
       
   671     }
       
   672 
       
   673 // ---------------------------------------------------------
       
   674 // CUniEditorLaunchOperation::ParseResult
       
   675 // ---------------------------------------------------------
       
   676 //
       
   677 TInt CUniEditorLaunchOperation::ParseResult()
       
   678     {
       
   679     TInt parseResult = iDocument.UpdatedNonConformantCount();
       
   680     parseResult += iParseResultTemp;
       
   681     
       
   682     return parseResult;
       
   683     }
       
   684 	
       
   685 // ---------------------------------------------------------
       
   686 // CUniEditorLaunchOperation::IsOptimizedFlagSet
       
   687 // ---------------------------------------------------------
       
   688 //
       
   689 TBool CUniEditorLaunchOperation::IsOptimizedFlagSet()
       
   690     {
       
   691     return iOptimizedFlow; 
       
   692     }
       
   693 
       
   694 // EOF